Skip to content

Commit

Permalink
Simplify code of user preference handler
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Dec 22, 2019
1 parent 5292f24 commit 79d07e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/globaleaks/handlers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def db_user_update_user(session, tid, user_session, request):
new_password = request['password']
old_password = request['old_password']

if new_password:
if request['password']:
if user.password_change_needed:
user.password_change_needed = False
else:
if not GCE.check_password(user.hash_alg,
old_password,
request['old_password'],
user.salt,
user.password):
raise errors.InvalidOldPassword
Expand All @@ -140,7 +140,7 @@ def db_user_update_user(session, tid, user_session, request):
user.hash_alg = 'ARGON2'
user.salt = GCE.generate_salt()

password_hash = GCE.hash_password(new_password, user.salt)
password_hash = GCE.hash_password(request['password'], user.salt)

# Check that the new password is different form the current password
if user.password == password_hash:
Expand Down

0 comments on commit 79d07e7

Please sign in to comment.