From afd0a88fc0008f8bfeb2be88fa4e332832d3c542 Mon Sep 17 00:00:00 2001 From: Xavier Date: Wed, 7 Oct 2026 00:44:25 +0200 Subject: [PATCH] =?UTF-8?q?Suppression=20de=20passlib=20par=20bcrypt=20et?= =?UTF-8?q?=20modification=20des=20fichiers=20li=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/auth.py | 12 +++++------- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/auth.py b/backend/auth.py index 1e521b5..e671d25 100644 --- a/backend/auth.py +++ b/backend/auth.py @@ -1,16 +1,14 @@ -from passlib.context import CryptContext +import bcrypt import pyotp -# Configuration du hachage (bcrypt) -pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") - def verify_password(plain_password: str, hashed_password: str) -> bool: """Vérifie si le mot de passe en clair correspond au hash.""" - return pwd_context.verify(plain_password, hashed_password) + return bcrypt.checkpw(plain_password.encode('utf-8'), hashed_password.encode('utf-8')) def get_password_hash(password: str) -> str: - """Génère le hash d'un mot de passe.""" - return pwd_context.hash(password) + """Génère le hash sécurisé d'un mot de passe.""" + salt = bcrypt.gensalt() + return bcrypt.hashpw(password.encode('utf-8'), salt).decode('utf-8') def generate_totp_secret() -> str: """Génère un secret aléatoire pour l'application 2FA (Authenticator, Keepassium).""" diff --git a/requirements.txt b/requirements.txt index 0390673..bba0705 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,5 +8,5 @@ qrcode psutil python-dotenv python-multipart -passlib[bcrypt] +bcrypt email-validator \ No newline at end of file