aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmu4web/password.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mu4web/password.py b/mu4web/password.py
index ff0df21..2b4aaa0 100755
--- a/mu4web/password.py
+++ b/mu4web/password.py
@@ -82,7 +82,9 @@ class Passwords:
def validate(self, username: str, password: str) -> bool:
"""Check if user exists, and if it has a correct password."""
# These shall fail when key is missing
- data = self.db[username]
+ data = self.db.get(username)
+ if not data:
+ return False
proc = hash_methods[data['method']]
digest = proc((data['salt'] + password).encode('UTF-8')).hexdigest()
return data['hash'] == digest