feat(session-verify): 添加 TOTP 支持 (#34)
* chore(deps): add pyotp * feat(auth): implement TOTP verification feat(auth): implement TOTP verification and email verification services - Added TOTP keys management with a new database model `TotpKeys`. - Introduced `EmailVerification` and `LoginSession` models for email verification. - Created `verification_service` to handle email verification logic and TOTP processes. - Updated user response models to include session verification methods. - Implemented routes for TOTP creation, verification, and fallback to email verification. - Enhanced login session management to support new location checks and verification methods. - Added migration script to create `totp_keys` table in the database. * feat(config): update config example * docs(totp): complete creating TOTP flow * refactor(totp): resolve review * feat(api): forbid unverified request * fix(totp): trace session by token id to avoid other sessions are forbidden * chore(linter): make pyright happy * fix(totp): only mark sessions with a specified token id
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from .achievement import UserAchievement, UserAchievementResp
|
||||
from .auth import OAuthClient, OAuthToken, V1APIKeys
|
||||
from .auth import OAuthClient, OAuthToken, TotpKeys, V1APIKeys
|
||||
from .beatmap import (
|
||||
Beatmap,
|
||||
BeatmapResp,
|
||||
@@ -25,10 +25,10 @@ from .counts import (
|
||||
ReplayWatchedCount,
|
||||
)
|
||||
from .daily_challenge import DailyChallengeStats, DailyChallengeStatsResp
|
||||
from .email_verification import EmailVerification, LoginSession
|
||||
from .events import Event
|
||||
from .favourite_beatmapset import FavouriteBeatmapset
|
||||
from .lazer_user import (
|
||||
MeResp,
|
||||
User,
|
||||
UserResp,
|
||||
)
|
||||
@@ -67,6 +67,7 @@ from .user_account_history import (
|
||||
UserAccountHistoryType,
|
||||
)
|
||||
from .user_login_log import UserLoginLog
|
||||
from .verification import EmailVerification, LoginSession
|
||||
|
||||
__all__ = [
|
||||
"APIUploadedRoom",
|
||||
@@ -93,6 +94,7 @@ __all__ = [
|
||||
"ItemAttemptsCount",
|
||||
"ItemAttemptsResp",
|
||||
"LoginSession",
|
||||
"MeResp",
|
||||
"MonthlyPlaycounts",
|
||||
"MultiplayerEvent",
|
||||
"MultiplayerEventResp",
|
||||
@@ -126,6 +128,7 @@ __all__ = [
|
||||
"Team",
|
||||
"TeamMember",
|
||||
"TeamRequest",
|
||||
"TotpKeys",
|
||||
"User",
|
||||
"UserAccountHistory",
|
||||
"UserAccountHistoryResp",
|
||||
|
||||
Reference in New Issue
Block a user