fix: 将密码最小长度调整为 11 位

This commit is contained in:
shenlei
2026-07-20 15:11:02 +09:00
parent cf6cc1d21a
commit 8c0bce45a4
3 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -35,8 +35,8 @@ async def create_user(data: dict, user: dict = Depends(get_current_user), db: Se
if not username or not password:
raise HTTPException(status_code=400, detail="用户名和密码不能为空")
if len(password) < 12:
raise HTTPException(status_code=400, detail="密码至少 12")
if len(password) < 11:
raise HTTPException(status_code=400, detail="密码至少 11")
if db.query(User).filter(User.username == username).first():
raise HTTPException(status_code=400, detail="用户名已存在")
@@ -61,8 +61,8 @@ async def change_password(user_id: str, data: dict, user: dict = Depends(get_cur
raise HTTPException(status_code=404, detail="用户不存在")
new_password = data.get("password", "").strip()
if not new_password or len(new_password) < 12:
raise HTTPException(status_code=400, detail="密码至少 12")
if not new_password or len(new_password) < 11:
raise HTTPException(status_code=400, detail="密码至少 11")
target.password_hash = hash_password(new_password)
db.commit()