Archived
feat(routes): 迁移认证端点(login/logout/heartbeat/ann_seen)
- web/routers/auth.py
· login:邮箱/用户名登录、超长密码短路、失败锁定、封禁/禁用分支、
管理员转 2FA 票据;成功签发 core.session 会话 Cookie(与 Flask 同格式)
· logout:递增 login_seq 顶号 + 删 Cookie
· heartbeat:次数校验(401/expired 语义同 Flask)
· ann_seen:记录已读公告版本
· 失败锁定与 2FA 票据表复用 auth_routes 模块级状态(跨栈共享,防绕锁定)
· PBKDF2 与库操作走 asyncio.to_thread,不阻塞事件循环
测试:tests/test_auth_routes.py 5 项,全部使用**沙箱库**(pytest tmp_path +
monkeypatch auth_system/core.db 路径),不触碰生产 data/site.db。
全套:pytest 56/56;ruff All checks passed;pyright 0 errors;奇偶校验 28/28。
This commit is contained in:
1 parent
18c77296c2
commit
91c032a1c3
3 files changed
+339
No files matched your search
@@ -24,6 +24,7 @@ from core.security import init_secret_key
|
||||
from web.errors import install_error_handlers
|
||||
from web.middleware import ResponseHygieneMiddleware
|
||||
from web.routers import account as account_router
|
||||
from web.routers import auth as auth_router
|
||||
from web.routers import auth_status as auth_status_router
|
||||
from web.routers import delivery as delivery_router
|
||||
from web.routers import index as index_router
|
||||
@@ -89,6 +90,7 @@ def create_app(serve_flask_fallback: bool = False) -> FastAPI:
|
||||
app.include_router(delivery_router.router, prefix='/api/v1', tags=['delivery'])
|
||||
app.include_router(stream_router.router, prefix='/api/v1', tags=['stream'])
|
||||
app.include_router(auth_status_router.router, prefix='/api/v1', tags=['auth'])
|
||||
app.include_router(auth_router.router, prefix='/api/v1', tags=['auth'])
|
||||
# 首页与静态资源(迁移完成形态;fallback 模式下同路径也能由 Flask 提供)
|
||||
app.include_router(index_router.router, tags=['index'])
|
||||
|
||||
|
||||
Reference in new issue
Block a user