Use sha512.hash() instead of .encrypt()
Now that we have switched to passlib 1.7.0, remove the temporary workaround and use the new function. Change-Id: Id574221f65d72a763b8205df0891b6e300856230 Depends-On: I6525dc8cf305ae03b81a53ac7fd06bf63d4a6d48 Closes-Bug: 1644263
This commit is contained in:
parent
58a7321d71
commit
71cde670d5
|
@ -132,14 +132,8 @@ def hash_user_password(user):
|
|||
def hash_password(password):
|
||||
"""Hash a password. Hard."""
|
||||
password_utf8 = verify_length_and_trunc_password(password).encode('utf-8')
|
||||
try:
|
||||
return passlib.hash.sha512_crypt.encrypt(
|
||||
password_utf8, rounds=CONF.crypt_strength)
|
||||
except DeprecationWarning:
|
||||
# TODO(stevemar): Remove this try/except once we switch over to passlib
|
||||
# version 1.7.0 and replace encrypt() with hash()
|
||||
return passlib.hash.sha512_crypt.hash(
|
||||
password_utf8, rounds=CONF.crypt_strength)
|
||||
return passlib.hash.sha512_crypt.hash(
|
||||
password_utf8, rounds=CONF.crypt_strength)
|
||||
|
||||
|
||||
def check_password(password, hashed):
|
||||
|
|
Loading…
Reference in New Issue