v0.7.1测试

This commit is contained in:
canglan committed 2026-04-15 10:16:22 +08:00
1 parent 637f3b665d
commit 3ba87367df
5 files changed
+22 -7

No files matched your search

+3 -3
View File
@@ -107,15 +107,15 @@ class AuthService:
return {"success": True, "message": "登出成功"}
@staticmethod
async def change_password(user_id: int, old_password: str, new_password: str) -> Dict[str, Any]:
async def change_password(user_id: int, old_password: str, new_password: str, force: bool = False) -> Dict[str, Any]:
"""修改密码"""
# 获取用户信息
user = await UserModel.get_by_user_id(user_id)
if not user:
return {"success": False, "message": "用户不存在"}
# 验证原密码
if not security.verify_password(old_password, user["password_hash"]):
# 验证原密码(强制改密时跳过)
if not force and not security.verify_password(old_password, user["password_hash"]):
return {"success": False, "message": "原密码错误"}
# 验证新密码强度