From 7b7828daa0018cc5eb4f4891cf07041895207a3e Mon Sep 17 00:00:00 2001 From: carry <2641257231@qq.com> Date: Mon, 20 Jan 2025 22:16:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/auth.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/auth.py b/services/auth.py index 9f22dee..1b6218b 100644 --- a/services/auth.py +++ b/services/auth.py @@ -1,11 +1,12 @@ from passlib.context import CryptContext +# 创建一个密码上下文对象,指定使用 bcrypt 加密算法 pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") def get_password_hash(password: str) -> str: - """Generate password hash using bcrypt""" + """生成密码的哈希值,使用 bcrypt 算法进行加密""" return pwd_context.hash(password) def verify_password(plain_password: str, hashed_password: str) -> bool: - """Verify password against stored hash""" + """验证输入的明文密码是否与存储的哈希密码匹配""" return pwd_context.verify(plain_password, hashed_password)