fix: incorrect password format

This commit is contained in:
2huo
2024-01-14 21:37:01 +08:00
committed by EstrellaXD
parent dfc511959f
commit f521044fcd

View File

@@ -24,6 +24,10 @@ class UserDatabase:
def auth_user(self, user: User):
statement = select(User).where(User.username == user.username)
result = self.session.exec(statement).first()
if not user.password:
return ResponseModel(
status_code=401, status=False, msg_en="Incorrect password format", msg_zh="密码格式不正确"
)
if not result:
return ResponseModel(
status_code=401, status=False, msg_en="User not found", msg_zh="用户不存在"