do not break API. add a new function to verify and update password

This commit is contained in:
Christophe Simonis
2013-01-08 01:01:02 +01:00
parent d0497fc886
commit a89b76d648
3 changed files with 11 additions and 7 deletions
+8 -4
View File
@@ -82,12 +82,16 @@ def get_hmac(password):
return base64.b64encode(h.digest())
def verify_password(password, user):
verify, new_password = _pwd_context.verify_and_update(get_hmac(password), user.password)
if verify and new_password:
def verify_password(password, password_hash):
return _pwd_context.verify(get_hmac(password), password_hash)
def verify_and_update_password(password, user):
verified, new_password = _pwd_context.verify_and_update(get_hmac(password), user.password)
if verified and new_password:
user.password = new_password
_datastore.put(user)
return verify
return verified
def encrypt_password(password):