add authorization and admin role
This commit is contained in:
12
password_utils.py
Normal file
12
password_utils.py
Normal file
@ -0,0 +1,12 @@
|
||||
from passlib.context import CryptContext
|
||||
|
||||
# Инициализация контекста для хеширования паролей
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
|
||||
def verify_password(plain_password, hashed_password):
|
||||
"""Проверяет, соответствует ли пароль хешу"""
|
||||
return pwd_context.verify(plain_password, hashed_password)
|
||||
|
||||
def get_password_hash(password):
|
||||
"""Создаёт хеш пароля"""
|
||||
return pwd_context.hash(password)
|
Reference in New Issue
Block a user