Password should be encoded as 'utf-8' before creating hmac to support passwords with non-latin symbols

This commit is contained in:
Artem Andreev
2013-02-03 22:14:32 +04:00
parent adb2680289
commit 8085e0031e
+1 -1
View File
@@ -78,7 +78,7 @@ def get_hmac(password):
'must not be None when the value of `SECURITY_PASSWORD_HASH` is '
'set to "%s"' % _security.password_hash)
h = hmac.new(_security.password_salt, password, hashlib.sha512)
h = hmac.new(_security.password_salt, password.encode('utf-8'), hashlib.sha512)
return base64.b64encode(h.digest())