feat(database/repositories/user_repository.py): A new login verification method has been added

This commit is contained in:
Kita Trofimov
2025-10-26 16:32:02 +03:00
parent 251e1b6e57
commit 6483afa0d4
+9
View File
@@ -114,6 +114,15 @@ class UserRepository:
return User(*row) return User(*row)
return None return None
def is_valid_authenticate(self, email: str, password_hash: str) -> bool:
with get_connection() as conn:
with conn.cursor() as cur:
cur.execute("""
SELECT 1 FROM users
WHERE email = %s AND password_hash = %s
""", (email, password_hash))
return cur.fetchone() is not None
def user_exists(self, email: str) -> bool: def user_exists(self, email: str) -> bool:
with get_connection() as conn: with get_connection() as conn:
with conn.cursor() as cur: with conn.cursor() as cur: