Login now based on email
Build LinkLog Development Image / development-image (push) Successful in 10s
Build LinkLog Development Image / development-image (push) Successful in 10s
This commit is contained in:
@@ -5,9 +5,9 @@ from datetime import datetime, timezone
|
||||
from backend.app.database import get_connection, hash_password, verify_password
|
||||
|
||||
|
||||
def authenticate_user(username: str, password: str):
|
||||
def authenticate_user(email: str, password: str):
|
||||
with get_connection() as conn:
|
||||
row = conn.execute('SELECT * FROM users WHERE username = ?', (username,)).fetchone()
|
||||
row = conn.execute('SELECT * FROM users WHERE email = ?', (email,)).fetchone()
|
||||
if row is None or not verify_password(password, row['password_hash']):
|
||||
return None
|
||||
user = dict(row)
|
||||
@@ -23,7 +23,7 @@ def authenticate_user(username: str, password: str):
|
||||
return user
|
||||
|
||||
|
||||
def find_user(username: str):
|
||||
def find_user(email: str):
|
||||
with get_connection() as conn:
|
||||
row = conn.execute('SELECT * FROM users WHERE username = ?', (username,)).fetchone()
|
||||
row = conn.execute('SELECT * FROM users WHERE email = ?', (email,)).fetchone()
|
||||
return dict(row) if row else None
|
||||
|
||||
Reference in New Issue
Block a user