fix(captcha): wire scene switches and rename menu to 人机验证

- Admin: 登录权限 → 人机验证; 停用场景 → 启用场景 (opt-in)
- Normalize enabled_scenarios with legacy disabled_scenarios BC
- Sign-in: never soft-bypass captcha; cancel unlocks button
- Captcha JS: cancel path finishes pending callback as false
This commit is contained in:
2026-07-15 16:48:57 +08:00
parent 808d46664f
commit bc96edf384
10 changed files with 143 additions and 54 deletions
@@ -9,13 +9,17 @@ export const permissionsSchemas = {
*/
login: {
key: 'permissions.login',
title: '登录权限',
title: '人机验证',
icon: 'fas fa-shield-alt',
description: '管理登录、注册、评论等场景的人机验证与访问限制。',
description: '配置云验证码服务商,并选择需要强制人机验证的前端场景。',
defaults: {
enabled: false,
active_provider: '',
mode: 'always',
enabled_scenarios: [
'comment', 'login', 'register', 'bind', 'bind_phone',
'lostpassword', 'change_password', 'change_email', 'verify_email', 'download', 'signin',
],
disabled_scenarios: [],
tencent: {},
aliyun: {},
@@ -28,7 +32,7 @@ export const permissionsSchemas = {
title: '基础设置',
icon: 'fas fa-cog',
fields: [
{ key: 'enabled', label: '启用人机验证', type: 'switch', help: '开启后将在指定场景要求用户完成人机验证' },
{ key: 'enabled', label: '启用人机验证', type: 'switch', help: '总开关:关闭后所有场景均不验证' },
{
key: 'active_provider',
label: '当前服务商',
@@ -54,10 +58,10 @@ export const permissionsSchemas = {
dependsOn: { key: 'enabled', value: true },
},
{
key: 'disabled_scenarios',
label: '停用场景',
key: 'enabled_scenarios',
label: '启用场景',
type: 'checkbox',
help: '勾选后表示该场景不启用人机验证;未勾选的场景会启用。',
help: '勾选 = 该场景需要人机验证。取消勾选则该场景放行。',
dependsOn: { key: 'enabled', value: true },
options: [
{ label: '发表评论', value: 'comment' },
@@ -297,7 +301,7 @@ export const permissionsSchemas = {
key: 'permissions.download',
title: '下载权限',
icon: 'fas fa-download',
description: '下载门槛由 DownloadPermissions 页维护(cms_features);人机验证服务商在登录权限页。',
description: '下载门槛由 DownloadPermissions 页维护(cms_features);人机验证服务商在「人机验证」页。',
defaults: {},
groups: [],
},