05/24 Fix bugs

This commit is contained in:
2026-05-24 22:36:36 -04:00
parent 19bad27866
commit 9e1493eea7
5 changed files with 122 additions and 9 deletions
+28
View File
@@ -1668,3 +1668,31 @@ def consume_password_reset_token(token: str, new_password: str) -> bool:
finally:
if conn:
conn.close()
def purge_expired_reset_tokens():
"""Delete all expired password reset tokens."""
conn = None
try:
conn = get_connection()
cur = conn.cursor()
cur.execute("DELETE FROM password_reset_tokens WHERE expires_at < NOW()")
conn.commit()
cur.close()
finally:
if conn:
conn.close()
def delete_ai_analysis(analysis_id: int):
"""Permanently delete an AI analysis record."""
conn = None
try:
conn = get_connection()
cur = conn.cursor()
cur.execute("DELETE FROM ai_analysis_log WHERE id=%s", (analysis_id,))
conn.commit()
cur.close()
finally:
if conn:
conn.close()