Suppression de passlib par bcrypt et modification des fichiers liés
Build and Push Docker Image / build-and-push (push) Successful in 1m14s
Build and Push Docker Image / build-and-push (push) Successful in 1m14s
This commit is contained in:
1 parent
70b9bdc19f
commit
afd0a88fc0
2 files changed
+6
-8
No files matched your search
+5
-7
@@ -1,16 +1,14 @@
|
|||||||
from passlib.context import CryptContext
|
import bcrypt
|
||||||
import pyotp
|
import pyotp
|
||||||
|
|
||||||
# Configuration du hachage (bcrypt)
|
|
||||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
|
||||||
|
|
||||||
def verify_password(plain_password: str, hashed_password: str) -> bool:
|
def verify_password(plain_password: str, hashed_password: str) -> bool:
|
||||||
"""Vérifie si le mot de passe en clair correspond au hash."""
|
"""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:
|
def get_password_hash(password: str) -> str:
|
||||||
"""Génère le hash d'un mot de passe."""
|
"""Génère le hash sécurisé d'un mot de passe."""
|
||||||
return pwd_context.hash(password)
|
salt = bcrypt.gensalt()
|
||||||
|
return bcrypt.hashpw(password.encode('utf-8'), salt).decode('utf-8')
|
||||||
|
|
||||||
def generate_totp_secret() -> str:
|
def generate_totp_secret() -> str:
|
||||||
"""Génère un secret aléatoire pour l'application 2FA (Authenticator, Keepassium)."""
|
"""Génère un secret aléatoire pour l'application 2FA (Authenticator, Keepassium)."""
|
||||||
|
|||||||
+1
-1
@@ -8,5 +8,5 @@ qrcode
|
|||||||
psutil
|
psutil
|
||||||
python-dotenv
|
python-dotenv
|
||||||
python-multipart
|
python-multipart
|
||||||
passlib[bcrypt]
|
bcrypt
|
||||||
email-validator
|
email-validator
|
||||||
Reference in new issue
Block a user