add error checking for non-existent users trying to log in
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user