FEAT: Added get_email util

UPDATE: Updated forgot password email route, changed send_email from a route to an internal function
This commit is contained in:
JustIceO7
2025-02-01 23:56:50 +00:00
parent 80609eceff
commit 36af1efe73
3 changed files with 26 additions and 17 deletions

View File

@@ -123,4 +123,14 @@ def reset_password(new_password: str, email: str) -> bool:
WHERE email = ?
""", (generate_password_hash(new_password), email))
return True
return True
def get_email(user_id: int) -> Optional[str]:
with Database() as db:
email = db.fetchone("""
SELECT email
FROM users
WHERE user_id = ?
""", (user_id,))
return email["email"] if email else None