06/04 Optimize app

This commit is contained in:
2026-06-04 13:25:57 -04:00
parent 0608f874fc
commit 0190da30d4
8 changed files with 158 additions and 65 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ def log_action(user_id, action, entity=None, entity_id=None, detail=None):
# ─── Authentication ────────────────────────────────────────────────────────────
def authenticate(username: str, password: str):
def authenticate(username: str, password: str, ip_address: str = None):
conn = None
try:
conn = get_connection()
@@ -66,7 +66,7 @@ def authenticate(username: str, password: str):
if not user or not _verify_password(password, user["password"]):
logger.warning(f"Failed login attempt for username='{username}'.")
cur.close()
record_failed_attempt(username)
record_failed_attempt(username, ip_address)
return None
if _needs_rehash(user["password"]):
new_hash = _hash_password(password)