fix: 用户中心占整页宽度; 管理员账号登录豁免Turnstile人机验证(管理后台无验证组件导致登录必失败)

This commit is contained in:
personal82555 committed 2026-10-12 20:11:28 +08:00
1 parent eb5c5c7f5c
commit 91cfb3b298
2 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -1103,10 +1103,12 @@ def user_api(method, sub, payload, handler):
return 200, {"code": 200, "message": "ok", "data": {"token": _make_token(username), "username": username}}
if method == "POST" and sub == "/login":
if not verify_turnstile(str(payload.get("cf_token") or "")):
return 403, {"code": 403, "message": "人机验证失败,请完成验证后重试"}
username = str(payload.get("username") or "").strip()
password = str(payload.get("password") or "")
# admin accounts skip the human check (admin panel login has no Turnstile widget)
role, _disabled = _user_attr(username)
if role != "admin" and not verify_turnstile(str(payload.get("cf_token") or "")):
return 403, {"code": 403, "message": "人机验证失败,请完成验证后重试"}
conn = _db()
row = conn.execute("SELECT salt, pw_hash FROM users WHERE username=?", (username,)).fetchone()
conn.close()