diff --git a/.gitignore b/.gitignore index 1e827085..63bbc3c9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ !/tests/widget-system/page-display-save-harness.php !/tests/widget-system/admin-ui-contract.test.cjs !/tests/widget-system/auth-source-contract.test.cjs +!/tests/widget-system/captcha-business-contract.test.cjs +!/tests/widget-system/captcha-security-harness.php +!/tests/widget-system/captcha-runtime-harness.test.cjs !/tests/widget-system/oauth-security-contract.test.cjs !/tests/widget-system/oauth-security-harness.php !/tests/widget-system/user-badges-contract.test.cjs diff --git a/assets/admin/src/api/modules/schema.js b/assets/admin/src/api/modules/schema.js index 98789349..6a4004c2 100644 --- a/assets/admin/src/api/modules/schema.js +++ b/assets/admin/src/api/modules/schema.js @@ -3,6 +3,12 @@ export const schemaApiMethods = { getSchemaPage(domain, section) { return this.request(`/settings/schema/${this.normalizeDomainKey(domain)}/${encodeURIComponent(section)}`) }, + testCaptcha(provider, token) { + return this.request('/captcha/test', { + method: 'POST', + body: JSON.stringify({ provider, token }), + }) + }, saveSchemaPage(domain, section, data, version = '1.0.0') { return this.request(`/settings/schema/${this.normalizeDomainKey(domain)}/${encodeURIComponent(section)}`, { method: 'POST', diff --git a/assets/admin/src/components/captcha/AliyunConfig.vue b/assets/admin/src/components/captcha/AliyunConfig.vue index f216b1ac..4c1f5d1c 100644 --- a/assets/admin/src/components/captcha/AliyunConfig.vue +++ b/assets/admin/src/components/captcha/AliyunConfig.vue @@ -40,9 +40,11 @@ v-model:value="model.access_key_secret" type="password" show-password-on="click" - autocomplete="current-password" + autocomplete="new-password" placeholder="阿里云 RAM 用户 AccessKey Secret" + @update:value="onSecretInput('access_key_secret', $event)" /> + 清除 请使用 RAM 子账号密钥并授权 AliyunYundunAFSFullAccess 权限,切勿使用主账号密钥。 @@ -58,6 +60,16 @@ import { computed } from 'vue' const model = defineModel({ type: Object, default: () => ({}) }) +const emit = defineEmits(['clear-secret', 'restore-secret']) + +function clearSecret(field) { + emit('clear-secret', field) + model.value = { ...model.value, [field]: '' } +} + +function onSecretInput(field, value) { + if (value !== '') emit('restore-secret', field) +} const isConfigured = computed(() => { const c = model.value diff --git a/assets/admin/src/components/captcha/CloudflareConfig.vue b/assets/admin/src/components/captcha/CloudflareConfig.vue index 38b3bf9f..fe78c690 100644 --- a/assets/admin/src/components/captcha/CloudflareConfig.vue +++ b/assets/admin/src/components/captcha/CloudflareConfig.vue @@ -5,10 +5,8 @@ - - - - + + 清除 @@ -26,6 +24,16 @@ import { computed } from 'vue' const model = defineModel({ type: Object, default: () => ({}) }) +const emit = defineEmits(['clear-secret', 'restore-secret']) + +function clearSecret(field) { + emit('clear-secret', field) + model.value = { ...model.value, [field]: '' } +} + +function onSecretInput(field, value) { + if (value !== '') emit('restore-secret', field) +} const isConfigured = computed(() => { const c = model.value diff --git a/assets/admin/src/components/captcha/GeetestConfig.vue b/assets/admin/src/components/captcha/GeetestConfig.vue index caf96c8f..e367eb15 100644 --- a/assets/admin/src/components/captcha/GeetestConfig.vue +++ b/assets/admin/src/components/captcha/GeetestConfig.vue @@ -5,7 +5,8 @@ - + + 清除 ✓ 已完整配置 未完成配置 @@ -17,6 +18,16 @@ import { computed } from 'vue' const model = defineModel({ type: Object, default: () => ({ product: 'bind' }) }) +const emit = defineEmits(['clear-secret', 'restore-secret']) + +function clearSecret(field) { + emit('clear-secret', field) + model.value = { ...model.value, [field]: '' } +} + +function onSecretInput(field, value) { + if (value !== '') emit('restore-secret', field) +} const isConfigured = computed(() => { const c = model.value diff --git a/assets/admin/src/components/captcha/TencentConfig.vue b/assets/admin/src/components/captcha/TencentConfig.vue index 9effbfb5..9ccf6041 100644 --- a/assets/admin/src/components/captcha/TencentConfig.vue +++ b/assets/admin/src/components/captcha/TencentConfig.vue @@ -9,7 +9,8 @@ - + + 清除 验证码密钥 @@ -17,7 +18,8 @@ - + + 清除 @@ -34,6 +36,16 @@ import { computed } from 'vue' const model = defineModel({ type: Object, default: () => ({}) }) +const emit = defineEmits(['clear-secret', 'restore-secret']) + +function clearSecret(field) { + emit('clear-secret', field) + model.value = { ...model.value, [field]: '' } +} + +function onSecretInput(field, value) { + if (value !== '') emit('restore-secret', field) +} const isConfigured = computed(() => { const c = model.value diff --git a/assets/admin/src/pages/SchemaPage.vue b/assets/admin/src/pages/SchemaPage.vue index 56bd0886..9f650219 100644 --- a/assets/admin/src/pages/SchemaPage.vue +++ b/assets/admin/src/pages/SchemaPage.vue @@ -19,28 +19,28 @@ v-if="isPermissionsLogin" #field-tencent="{ value, setValue }" > - +