添加邮件验证

This commit is contained in:
咕谷酱
2025-08-22 08:19:12 +08:00
parent 42f17d0c66
commit 3bee2421fa
19 changed files with 1594 additions and 22 deletions

17
app/models/api_me.py Normal file
View File

@@ -0,0 +1,17 @@
"""
APIMe 响应模型 - 对应 osu! 的 APIMe 类型
"""
from __future__ import annotations
from app.database.lazer_user import UserResp
class APIMe(UserResp):
"""
/me 端点的响应模型
对应 osu! 的 APIMe 类型,继承 APIUser(UserResp) 并包含 session_verified 字段
session_verified 字段已经在 UserResp 中定义,这里不需要重复定义
"""
pass

View File

@@ -0,0 +1,31 @@
"""
扩展的 OAuth 响应模型,支持二次验证
"""
from __future__ import annotations
from pydantic import BaseModel
class ExtendedTokenResponse(BaseModel):
"""扩展的令牌响应,支持二次验证状态"""
access_token: str | None = None
token_type: str = "Bearer"
expires_in: int | None = None
refresh_token: str | None = None
scope: str | None = None
# 二次验证相关字段
requires_second_factor: bool = False
verification_message: str | None = None
user_id: int | None = None # 用于二次验证的用户ID
class SessionState(BaseModel):
"""会话状态"""
user_id: int
username: str
email: str
requires_verification: bool
session_token: str | None = None
verification_sent: bool = False