增加“极验-行为验”验证码集成支持

This commit is contained in:
GoEdgeLab
2023-11-29 16:57:58 +08:00
parent 1f2093e031
commit 89255cb437
7 changed files with 117 additions and 20 deletions

View File

@@ -57,6 +57,11 @@ Vue.component("http-firewall-captcha-options-viewer", {
summaryList.push("定制UI")
}
}
if (this.options.geeTestConfig.isOn) {
summaryList.push("已配置极验")
}
if (summaryList.length == 0) {
this.summary = "默认配置"
} else {

View File

@@ -22,7 +22,12 @@ Vue.component("http-firewall-captcha-options", {
uiFooter: "",
uiBody: "",
cookieId: "",
lang: ""
lang: "",
geeTestConfig: {
isOn: false,
captchaId: "",
captchaKey: ""
}
}
}
if (options.countLetters <= 0) {
@@ -33,6 +38,7 @@ Vue.component("http-firewall-captcha-options", {
options.captchaType = "default"
}
return {
options: options,
isEditing: false,
@@ -92,6 +98,9 @@ Vue.component("http-firewall-captcha-options", {
} else {
this.uiBodyWarning = ""
}
},
"options.geeTestConfig.isOn": function (v) {
this.updateSummary()
}
},
methods: {
@@ -127,6 +136,10 @@ Vue.component("http-firewall-captcha-options", {
}
}
if (this.options.geeTestConfig.isOn) {
summaryList.push("已配置极验")
}
if (summaryList.length == 0) {
this.summary = "默认配置"
} else {
@@ -202,7 +215,6 @@ Vue.component("http-firewall-captcha-options", {
<td class="color-border">定制UI</td>
<td><checkbox v-model="options.uiIsOn"></checkbox></td>
</tr>
</tbody>
<tbody v-show="options.uiIsOn && options.captchaType == 'default'">
<tr>
@@ -254,6 +266,31 @@ Vue.component("http-firewall-captcha-options", {
</tr>
</tbody>
</table>
<table class="ui table definition selectable">
<tr>
<td class="title">允许用户使用极验</td>
<td><checkbox v-model="options.geeTestConfig.isOn"></checkbox>
<p class="comment">选中后表示允许用户在WAF设置中选择极验。</p>
</td>
</tr>
<tbody v-show="options.geeTestConfig.isOn">
<tr>
<td class="color-border">极验-验证ID *</td>
<td>
<input type="text" maxlength="100" name="geetestCaptchaId" v-model="options.geeTestConfig.captchaId" spellcheck="false"/>
<p class="comment">在极验控制台--业务管理中获取。</p>
</td>
</tr>
<tr>
<td class="color-border">极验-验证Key *</td>
<td>
<input type="text" maxlength="100" name="geetestCaptchaKey" v-model="options.geeTestConfig.captchaKey" spellcheck="false"/>
<p class="comment">在极验控制台--业务管理中获取。</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
`

View File

@@ -16,11 +16,25 @@ Vue.component("http-firewall-config-box", {
firewall.defaultCaptchaType = "none"
}
let allCaptchaTypes = window.WAF_CAPTCHA_TYPES.$copy()
// geetest
let geeTestIsOn = false
if (this.vFirewallPolicy != null && this.vFirewallPolicy.captchaAction != null && this.vFirewallPolicy.captchaAction.geeTestConfig != null) {
geeTestIsOn = this.vFirewallPolicy.captchaAction.geeTestConfig.isOn
}
// 如果没有启用geetest则还原
if (!geeTestIsOn && firewall.defaultCaptchaType == "geetest") {
firewall.defaultCaptchaType = "none"
}
return {
firewall: firewall,
moreOptionsVisible: false,
execGlobalRules: !firewall.ignoreGlobalRules,
captchaTypes: window.WAF_CAPTCHA_TYPES
captchaTypes: allCaptchaTypes,
geeTestIsOn: geeTestIsOn
}
},
watch: {
@@ -66,7 +80,7 @@ Vue.component("http-firewall-config-box", {
<td>
<select class="ui dropdown auto-width" v-model="firewall.defaultCaptchaType">
<option value="none">默认</option>
<option v-for="captchaType in captchaTypes" :value="captchaType.code">{{captchaType.name}}</option>
<option v-for="captchaType in captchaTypes" v-if="captchaType.code != 'geetest' || geeTestIsOn" :value="captchaType.code">{{captchaType.name}}</option>
</select>
<p class="comment" v-if="firewall.defaultCaptchaType == 'none'">使用系统默认的设置。</p>
<p class="comment" v-for="captchaType in captchaTypes" v-if="captchaType.code == firewall.defaultCaptchaType">{{captchaType.description}}</p>