feat(database/repositories/user_repository.py): A new login verification method has been added
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user