更新 user.py

This commit is contained in:
jxxghp 2024-01-19 10:54:13 +08:00 committed by GitHub
parent 16a4f61fec
commit 1f56ceaea9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,7 +63,7 @@ def update_user(
# 正则表达式匹配密码包含大写字母、小写字母、数字
pattern = r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]+$'
if not re.match(pattern, user_info.get("password")):
return schemas.Response(success=False, message="密码需包含大小写数字")
return schemas.Response(success=False, message="密码需要同时包含大小写数字")
user_info["hashed_password"] = get_password_hash(user_info["password"])
user_info.pop("password")
user = User.get_by_name(db, name=user_info["name"])