начало БД
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from passlib.context import CryptContext
|
||||
|
||||
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
|
||||
|
||||
def pwd_hash(pwd_plant: str) -> str:
|
||||
return pwd_context.encrypt(pwd_plant)
|
||||
|
||||
|
||||
def pwd_verify(pwd_plant: str, pwd_hash: str) -> bool:
|
||||
from my_loggers import logger
|
||||
|
||||
try:
|
||||
return pwd_context.verify(pwd_plant, pwd_hash)
|
||||
except Exception as e:
|
||||
logger.error(f"Password verification error: {str(e)}")
|
||||
return False
|
||||
Reference in New Issue
Block a user