Merge "Use sha512.hash() instead of .encrypt()"
This commit is contained in:
commit
cf5d5106fb
|
@ -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