Skip to content

Commit 5021350

Browse files
committed
WAF策略中验证码动作页面模板中使用<form></form>包裹${body}时提示警告
1 parent 41b3dab commit 5021350

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

web/public/js/components/server/http-firewall-captcha-options.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Vue.component("http-firewall-captcha-options", {
3030
return {
3131
options: options,
3232
isEditing: false,
33-
summary: ""
33+
summary: "",
34+
uiBodyWarning: ""
3435
}
3536
},
3637
watch: {
@@ -74,6 +75,13 @@ Vue.component("http-firewall-captcha-options", {
7475
},
7576
"options.uiIsOn": function (v) {
7677
this.updateSummary()
78+
},
79+
"options.uiBody": function (v) {
80+
if (/<form(>|\s).+\$\{body}.*<\/form>/s.test(v)) {
81+
this.uiBodyWarning = "页面模板中不能使用<form></form>标签包裹\${body}变量,否则将导致验证码表单无法提交。"
82+
} else {
83+
this.uiBodyWarning = ""
84+
}
7785
}
7886
},
7987
methods: {
@@ -208,7 +216,7 @@ Vue.component("http-firewall-captcha-options", {
208216
<td class="color-border">页面模板</td>
209217
<td>
210218
<textarea spellcheck="false" rows="2" v-model="options.uiBody"></textarea>
211-
<p class="comment"><span v-if="options.uiBody.length > 0 && options.uiBody.indexOf('\${body}') < 0 " class="red">模板中必须包含\${body}表示验证码表单!</span>整个页面的模板,支持HTML,其中必须使用<code-label>\${body}</code-label>变量代表验证码表单,否则将无法正常显示验证码。</p>
219+
<p class="comment"><span v-if="uiBodyWarning.length > 0" class="red">警告:{{uiBodyWarning}}</span><span v-if="options.uiBody.length > 0 && options.uiBody.indexOf('\${body}') < 0 " class="red">模板中必须包含\${body}表示验证码表单!</span>整个页面的模板,支持HTML,其中必须使用<code-label>\${body}</code-label>变量代表验证码表单,否则将无法正常显示验证码。</p>
212220
</td>
213221
</tr>
214222
</tbody>

0 commit comments

Comments
 (0)