Files
ClassManager/backend/schemas/auth.py
2026-04-15 10:16:22 +08:00

55 lines
1.5 KiB
Python

# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: Canglan
# 联系方式: admin@sea-studio.top
# 版权归属: Sea Network Technology Studio
# 许可证: MIT License
#
# 版权所有 © Sea Network Technology Studio
# ===========================================
from pydantic import BaseModel, Field
from typing import Optional
class LoginRequest(BaseModel):
"""登录请求"""
username: str = Field(..., min_length=1, max_length=50, description="用户名")
password: str = Field(..., min_length=1, max_length=50, description="密码")
class LoginResponse(BaseModel):
"""登录响应"""
success: bool
token: str
user_id: int
username: str
real_name: str
user_type: str
need_change_password: bool
redirect: str
class ChangePasswordRequest(BaseModel):
"""修改密码请求"""
old_password: str = Field(default="", max_length=50, description="原密码")
new_password: str = Field(..., min_length=6, max_length=20, description="新密码")
force: bool = Field(default=False, description="是否强制修改(首次登录)")
class ChangePasswordResponse(BaseModel):
"""修改密码响应"""
success: bool
message: str
class UserInfo(BaseModel):
"""用户信息"""
user_id: int
username: str
real_name: str
user_type: str
student_id: Optional[int] = None
role: Optional[str] = None
need_change_password: bool