Login now based on email
Build LinkLog Development Image / development-image (push) Successful in 10s

This commit is contained in:
2026-08-26 15:03:48 +02:00
parent dd44b380ce
commit 079eb146f6
12 changed files with 64 additions and 40 deletions
+4 -4
View File
@@ -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