feat: add password change settings
ci / docker (push) Successful in 3m38s

This commit is contained in:
2026-09-07 17:35:09 +08:00
parent 5d564b0269
commit 635930db50
6 changed files with 118 additions and 1 deletions
+11
View File
@@ -14,6 +14,17 @@ class LoginRequest(BaseModel):
password: str
class ChangePasswordRequest(BaseModel):
current_password: str = Field(min_length=1, max_length=256)
new_password: str = Field(min_length=12, max_length=256)
@model_validator(mode="after")
def reject_same_password(self):
if self.current_password == self.new_password:
raise ValueError("新密码不能与当前密码相同")
return self
class UserOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: UUID