60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
from pydantic import BaseModel, constr
|
||
from typing import Union
|
||
|
||
EMailRegex = constr(regex="^[a-zA-Z0-9_-]+@fecr.com.cn$")
|
||
passwordRegex = constr(regex="^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)^.{8,}$")
|
||
|
||
|
||
class ImageCaptchaRes(BaseModel):
|
||
captcha_id: str
|
||
img_data: str
|
||
|
||
|
||
class LoginReqBody(BaseModel):
|
||
email: EMailRegex = "xxxx@fecr.com.cn"
|
||
password: passwordRegex = "包含大小写字母和数字,长度8-16位"
|
||
captcha_id: str
|
||
captcha_code: str
|
||
app_id: Union[str, None] #
|
||
|
||
|
||
class EmailSendReqBody(BaseModel):
|
||
email: EMailRegex = "xxxx@fecr.com.cn"
|
||
|
||
|
||
class UserInfo(BaseModel):
|
||
id: str
|
||
email: str
|
||
name: Union[str, None]
|
||
avatar: Union[str, None]
|
||
role: Union[str, None]
|
||
department: Union[str, None]
|
||
post: Union[str, None]
|
||
auth_data: Union[str, None]
|
||
|
||
|
||
class LoginResBody(UserInfo):
|
||
access_token: str
|
||
token_type: str
|
||
app_id: Union[str, None] #
|
||
|
||
|
||
class RegisterReqBody(BaseModel):
|
||
email: EMailRegex
|
||
password: passwordRegex
|
||
email_verify_code: str
|
||
|
||
|
||
class RestPasswordReqBody(BaseModel):
|
||
email: EMailRegex
|
||
email_verify_code: str
|
||
|
||
|
||
class TokenData(BaseModel):
|
||
id: str
|
||
name: Union[str, None]
|
||
role: Union[str, None]
|
||
department: Union[str, None]
|
||
post: Union[str, None]
|
||
auth_data: Union[str, None]
|