feat: add PATCH /user/settings/password endpoint for changing password

Register the fixed /password route before the wildcard /{option} to
prevent FastAPI from matching it as a path parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 15:11:56 +08:00
parent eac0766e79
commit 0b521ae8ab
3 changed files with 49 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ from .auth_identity import (
AuthIdentityResponse,
AuthProviderType,
BindIdentityRequest,
ChangePasswordRequest,
)
from .user import (
BatchDeleteRequest,

View File

@@ -81,6 +81,16 @@ class BindIdentityRequest(SQLModelBase):
"""OAuth 回调地址"""
class ChangePasswordRequest(SQLModelBase):
"""修改密码请求 DTO"""
old_password: str = Field(min_length=1)
"""当前密码"""
new_password: str = Field(min_length=8, max_length=128)
"""新密码(至少 8 位)"""
# ==================== 数据库模型 ====================
class AuthIdentity(SQLModelBase, UUIDTableBaseMixin):