feat: add account self-service safeguards

This commit is contained in:
hailin
2026-07-16 17:15:20 +08:00
parent 74427497c3
commit b26341d9a7
6 changed files with 433 additions and 7 deletions

View File

@@ -40,6 +40,8 @@ class CurrentUserOut(Schema):
username: str
display_name: str
email: str
last_login: datetime | None = None
date_joined: datetime
is_superuser: bool
roles: list[RoleOut]
user_groups: list[UserGroupOut]
@@ -73,6 +75,33 @@ class UserUpdateIn(Schema):
is_active: bool | None = None
class ProfileUpdateIn(Schema):
display_name: str | None = None
email: str | None = None
class PasswordChangeIn(Schema):
current_password: str
new_password: str
class ProfileActivityOut(Schema):
id: int
ticket_id: int
ticket_no: str
ticket_title: str
event_type: str
created_at: datetime
class ProfileStatsOut(Schema):
created_total: int
active_assigned: int
completed_30d: int
completion_rate: float
recent_activity: list[ProfileActivityOut] = []
class PasswordResetIn(Schema):
password: str