05/02/2026 updated code for security 2d
This commit is contained in:
@@ -129,7 +129,7 @@ def blacklist_token(token: str, token_type: str) -> None:
|
||||
if not jti:
|
||||
return
|
||||
exp = payload.get('exp')
|
||||
expires_at = datetime.fromtimestamp(exp) if exp else datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(days=7, tz=timezone.utc).replace(tzinfo=None)
|
||||
expires_at = datetime.fromtimestamp(exp, tz=timezone.utc).replace(tzinfo=None) if exp else datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(days=7)
|
||||
from app.models.token_blacklist import TokenBlacklist
|
||||
from app import db
|
||||
# Avoid duplicate if already blacklisted
|
||||
@@ -279,4 +279,4 @@ def verify_and_consume_backup_code(hashed_codes: list[str], candidate: str) -> t
|
||||
return False, hashed_codes
|
||||
|
||||
remaining = [h for i, h in enumerate(hashed_codes) if i != matched_index]
|
||||
return True, remaining
|
||||
return True, remaining
|
||||
Reference in New Issue
Block a user