From 771f7e05493377dd2bb7459de88b87e46dc0422a Mon Sep 17 00:00:00 2001 From: Kita Trofimov <144846094+NiTro005@users.noreply.github.com> Date: Sun, 26 Oct 2025 16:32:02 +0300 Subject: [PATCH] feat(database/repositories/user_repository.py): A new login verification method has been added --- database/repositories/user_repository.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/database/repositories/user_repository.py b/database/repositories/user_repository.py index d624842..22bb523 100644 --- a/database/repositories/user_repository.py +++ b/database/repositories/user_repository.py @@ -114,6 +114,15 @@ class UserRepository: return User(*row) 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: with get_connection() as conn: with conn.cursor() as cur: