Coverage for classes/user_manager.py: 94%
16 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-30 23:17 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-30 23:17 +0000
1from config.database import Database
3class UserManager:
4 @staticmethod
5 def verify_credentials(username, password):
6 try:
7 conn = Database.get_connection()
8 cursor = conn.cursor()
9 cursor.execute("SELECT UserId, Username, PasswordHash FROM Users WHERE Username = ?", username)
10 user = cursor.fetchone()
12 if user and password == user.PasswordHash:
13 return user
14 return None
16 finally:
17 if 'cursor' in locals() and cursor is not None:
18 cursor.close()
19 if 'conn' in locals() and conn is not None:
20 conn.close()