Skip to content

Commit

Permalink
Correction en classe
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Berger committed Mar 23, 2018
1 parent 1c90561 commit e533916
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Flask/login/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def log_user():
return redirect("/")

salt = user[0]
hashed_password = hashlib.sha512(password + salt).hexdigest()
hashed_password = hashlib.sha512(str(password + salt).encode("utf-8")).hexdigest()
if hashed_password == user[1]:
# Accès autorisé
id_session = uuid.uuid4().hex
Expand All @@ -112,10 +112,9 @@ def decorated(*args, **kwargs):
@app.route('/logout')
@authentication_required
def logout():
if "id" in session:
id_session = session["id"]
session.pop('id', None)
get_db().delete_session(id_session)
id_session = session["id"]
session.pop('id', None)
get_db().delete_session(id_session)
return redirect("/")


Expand Down

0 comments on commit e533916

Please sign in to comment.