Fix exception handling in argon2 for mismatching passwords

This commit is contained in:
Arvedui
2019-12-02 23:43:28 +01:00
parent 138c62e35a
commit 672a702673
+2 -1
View File
@@ -12,6 +12,7 @@ from passlib.hash import bcrypt, md5_crypt, sha256_crypt, sha512_crypt
try:
from argon2 import PasswordHasher as argon2_hasher
from argon2 import exceptions as argon2_exceptions
except ImportError:
argon2_hasher = None
@@ -155,7 +156,7 @@ if argon2_hasher is not None:
def verify(self, clearvalue, hashed_value):
try:
return self.hasher.verify(hashed_value, clearvalue)
except argon2_hasher.exceptions.VerifyMismatchError:
except argon2_exceptions.VerifyMismatchError:
return False
def needs_rehash(self, hashed_value):