M4-T04: add AuthUser TOTP columns and auth_recovery_code table

This commit is contained in:
2026-06-21 21:38:22 +02:00
parent 5481fbc99c
commit 5026967cee
7 changed files with 373 additions and 5 deletions
+1 -1
View File
@@ -188,7 +188,7 @@ Phase BTOTP,可选配)
- **Reviewer checklist**: 密码可交互输入且不回显;只动 auth 行;幂等可重跑。
### M4-T04 — AuthUser TOTP 字段 + `auth_recovery_code` 表 `[schema]`
- **Status**: `todo` · **Depends**: none(与 Phase A 并行的 schema,但 T06 依赖 T02
- **Status**: `done` · **Depends**: none(与 Phase A 并行的 schema,但 T06 依赖 T02
- **Files**: `modify app/models/auth.py``AuthUser.totp_secret`/`totp_enabled`);`create` 模型 `RecoveryCode``create alembic_app/versions/<date>_NN_totp.py``modify alembic_app/env.py``scripts/app_db_adopt.py``create tests/test_totp_models.py`
- **Steps**: `totp_secret` nullable、`totp_enabled` bool default false`auth_recovery_code(user_id FK, code_hash, used_at nullable)`revision 建列 + 表;更新 baseline。
- **Out of scope / 不要碰**: 不写 TOTP 逻辑(T05)。