feat: 人机验证可开关 + 登录注册入口白名单
- 系统设置新增「人机验证」页: 总开关 + 按入口勾选 - 客户端 verify/activate/check-update 永不校验 Turnstile - 公开 GET /api/public/turnstile-config 供登录页按需展示组件
This commit is contained in:
1 parent
217c083544
commit
7c85ecdd2d
9 files changed
+262
-21
No files matched your search
@@ -53,9 +53,10 @@ class AuthController extends Controller
|
||||
$this->error('请输入用户名或邮箱');
|
||||
}
|
||||
|
||||
// Cloudflare Turnstile 人机验证
|
||||
// Cloudflare Turnstile(按系统配置开关与入口白名单)
|
||||
$portalKey = $portal === 'agent' ? 'agent_login' : 'admin_login';
|
||||
$turnstileToken = trim((string) ($input['turnstile_token'] ?? ''));
|
||||
if (!TurnstileService::verify($turnstileToken !== '' ? $turnstileToken : null, clientIp())) {
|
||||
if (!TurnstileService::verifyFor($portalKey, $turnstileToken !== '' ? $turnstileToken : null, clientIp())) {
|
||||
$this->error('人机验证失败,请完成验证后重试');
|
||||
}
|
||||
|
||||
@@ -132,9 +133,9 @@ class AuthController extends Controller
|
||||
$this->error('两次输入的密码不一致');
|
||||
}
|
||||
|
||||
// Cloudflare Turnstile 人机验证
|
||||
// Cloudflare Turnstile(按系统配置开关与入口白名单)
|
||||
$turnstileToken = trim((string) ($input['turnstile_token'] ?? ''));
|
||||
if (!TurnstileService::verify($turnstileToken !== '' ? $turnstileToken : null, clientIp())) {
|
||||
if (!TurnstileService::verifyFor('agent_register', $turnstileToken !== '' ? $turnstileToken : null, clientIp())) {
|
||||
$this->error('人机验证失败,请完成验证后重试');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user