M4-T01: add auth_login_throttle table + LoginThrottle model
This commit is contained in:
@@ -145,7 +145,7 @@ Phase B(TOTP,可选配)
|
||||
> 后端沿用校验闸门(`pytest`/`ruff`/改路由或 schema 则 `export_openapi` 重导出入库)。前端闸门见 §8。新增依赖(`pyotp`、`qrcode.react`)须同步 `requirements.in/.txt` 与 `frontend/package.json` 重新锁定。
|
||||
|
||||
### M4-T01 — `auth_login_throttle` 表 + 模型 `[schema]`
|
||||
- **Status**: `todo` · **Depends**: none
|
||||
- **Status**: `done` · **Depends**: none
|
||||
- **Context**: 存按 IP / username 的失败退避状态。仅建 schema。
|
||||
- **Files**: `create app/models/auth_throttle.py`(或并入 `app/models/auth.py`);`create alembic_app/versions/<date>_NN_auth_login_throttle.py`;`modify alembic_app/env.py`、`scripts/app_db_adopt.py`(baseline 常量);`create tests/test_auth_throttle_model.py`
|
||||
- **Steps**: 模型 `LoginThrottle`(`id / key str / scope str('ip'|'user') / failures int / first_failed_at / last_failed_at / next_allowed_at`,`(scope,key)` unique 索引);新 revision 建表 + 索引;更新 baseline 常量。
|
||||
|
||||
Reference in New Issue
Block a user