Skip to content

Commit 9f47176

Browse files
committed
Fixed error with argon2 verification
1 parent 43eeabd commit 9f47176

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/PyMatcha/utils/password.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
along with this program. If not, see <https://www.gnu.org/licenses/>.
1818
"""
1919
from argon2 import PasswordHasher
20+
from argon2.exceptions import VerificationError
2021

2122
ph = PasswordHasher()
2223

@@ -26,4 +27,9 @@ def hash_password(password: str) -> str:
2627

2728

2829
def check_password(hash: str, password: str) -> bool:
29-
return ph.verify(hash, password)
30+
try:
31+
ph.verify(hash, password)
32+
except VerificationError:
33+
return False
34+
else:
35+
return True

0 commit comments

Comments
 (0)