[fix] Corrections ruff CI (UP017/UP041/UP012/I001/F401/FURB162) : backend/auth/router.py
This commit is contained in:
@@ -7,6 +7,7 @@ import binascii
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
from datetime import UTC
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends, HTTPException, Request, Response
|
from fastapi import APIRouter, Body, Depends, HTTPException, Request, Response
|
||||||
from pydantic import BaseModel, validator
|
from pydantic import BaseModel, validator
|
||||||
@@ -696,7 +697,7 @@ async def mfa_webauthn_register(
|
|||||||
|
|
||||||
Returns recovery codes when MFA is newly enabled (they were never issued).
|
Returns recovery codes when MFA is newly enabled (they were never issued).
|
||||||
"""
|
"""
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
|
|
||||||
from .user_store import get_user, update_user
|
from .user_store import get_user, update_user
|
||||||
from .webauthn_mfa import complete_registration, resolve_relying_party
|
from .webauthn_mfa import complete_registration, resolve_relying_party
|
||||||
@@ -716,7 +717,7 @@ async def mfa_webauthn_register(
|
|||||||
logger.warning(f"WebAuthn registration failed for {current_user['username']}: {e}")
|
logger.warning(f"WebAuthn registration failed for {current_user['username']}: {e}")
|
||||||
raise HTTPException(400, "Validation du credential WebAuthn échouée")
|
raise HTTPException(400, "Validation du credential WebAuthn échouée")
|
||||||
|
|
||||||
record["registered_at"] = datetime.now(timezone.utc).isoformat()
|
record["registered_at"] = datetime.now(UTC).isoformat()
|
||||||
creds = list(user.get("webauthn_credentials", []))
|
creds = list(user.get("webauthn_credentials", []))
|
||||||
creds = [c for c in creds if c.get("credential_id") != record["credential_id"]]
|
creds = [c for c in creds if c.get("credential_id") != record["credential_id"]]
|
||||||
creds.append(record)
|
creds.append(record)
|
||||||
|
|||||||
Reference in New Issue
Block a user