06/04 Optimize app
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user