feat(auth): 登录白名单细化为黑名单模式(approved 默认放行)+ 同步构建产物

- approved 放行标记默认 True:新账号首次登录即放行,登录白名单开关打开时只拦截
  被管理员显式「取消放行」(approved=False) 的用户;enforce_user_approved 放在
  各登录端点拿到 user 后、签发 JWT 前调用,admin 永远放行。
- 同步调整 LoginWhitelistPage / local_provider / models / system_settings /
  迁移 20260625_02 / user model / column_additions_mysql.sql 与 CLAUDE.md。
- 更新 backend/backend.zip 构建产物。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Opus 4.8 committed 2026-06-25 21:41:15 +08:00
1 parent f3f11461de
commit a417124c21
9 files changed
+47 -39

No files matched your search

@@ -1,8 +1,10 @@
"""Add users.approved (登录白名单放行标记).
Backs the login-whitelist feature: when system setting ``login_whitelist.enabled``
is on, only ``approved=True`` users (or admins) may log in; self-registered
regular users default to ``approved=False`` (待审批) until an admin approves them.
Backs the login-whitelist feature (黑名单模式): when system setting
``login_whitelist.enabled`` is on, only users an admin has explicitly
「取消放行」 (``approved=False``) are blocked; everyone else — including brand-new
accounts that have never logged in (which default to ``approved=True``) — may log
in. Admins always pass.
Existing rows are backfilled to TRUE (``server_default="1"``) so flipping the
switch on for the first time never locks out users who already had accounts.