add error checking for non-existent users trying to log in

This commit is contained in:
2025-07-03 09:22:43 +02:00
parent 6d8051e4e6
commit 290395d38d

View File

@@ -1217,10 +1217,13 @@ class Database:
Returns: Returns:
bool: True if the login was successful, False if not bool: True if the login was successful, False if not
""" """
salt = self.query_db( try:
"SELECT salt FROM user WHERE username=?", (user,), one=True salt = self.query_db(
)[0] "SELECT salt FROM user WHERE username=?", (user,), one=True
if salt is None: )[0]
if salt is None:
return False
except TypeError:
return False return False
hashed_password = salt + hashed_password hashed_password = salt + hashed_password
password = self.query_db( password = self.query_db(