修复登录页注册页极验无法验证第二次的问题

revert-735ad282
maxitio 7 years ago
parent f18ad3820f
commit 992acb62de

@ -1,5 +1,5 @@
# 请勿泄露源码给他人
# 不能删除页面底部的 Powered by SSPANEL. Theme by editXY
# 不能删改页面底部的 Powered by SSPANEL. Theme by editXY,不能删改staff页面的任何信息。
## 安装
在网站目录下
`git clone -b malio https://gitlab.com/maxitio/malio-theme-for-sspanel.git tmp && mv tmp/.git . && rm -rf tmp && git reset --hard`

@ -233,6 +233,27 @@
<!-- Page Specific JS File -->
<script src="/theme/malio/js/malio.js?{$malio_config['malio_js_version']}"></script>
{if $geetest_html != null}
<script src="//static.geetest.com/static/tools/gt.js"></script>
<script>
captcha = '';
var handlerEmbed = function (captchaObj) {
captchaObj.onSuccess(function () {
validate = captchaObj.getValidate();
});
captchaObj.appendTo("#embed-captcha");
captcha = captchaObj;
};
initGeetest({
gt: "{$geetest_html->gt}",
challenge: "{$geetest_html->challenge}",
product: "embed",
width: "100%",
offline: {if $geetest_html->success}0{else}1{/if}
}, handlerEmbed);
</script>
{/if}
<script>
function login() {
if (!$("#password").val() || !$("#email").val()) {
@ -240,12 +261,9 @@
}
{if $geetest_html != null}
if (typeof validate == 'undefined') {
swal('请验证身份', '请滑动验证码来完成验证。', 'error');
return;
}
if (!validate) {
swal('请验证身份', '请滑动验证码来完成验证。', 'error');
validate = captcha.getValidate();
if (typeof validate === 'undefined' || !validate) {
swal('请验证身份', '请滑动验证码来完成验证。', 'info');
return;
}
{/if}
@ -269,7 +287,8 @@
window.location.assign('/user')
} else {
{if $geetest_html != null}
captcha.refresh();
console.log(captcha)
captcha.reset();
{/if}
swal('出错了', '密码或邮箱不正确', 'error');
}
@ -378,25 +397,6 @@
</script>
{/if}
{if $geetest_html != null}
<script src="//static.geetest.com/static/tools/gt.js"></script>
<script>
var handlerEmbed = function (captchaObj) {
captchaObj.onSuccess(function () {
validate = captchaObj.getValidate();
});
captchaObj.appendTo("#embed-captcha");
captcha = captchaObj;
};
initGeetest({
gt: "{$geetest_html->gt}",
challenge: "{$geetest_html->challenge}",
product: "embed",
width: "100%",
offline: {if $geetest_html->success}0{else}1{/if}
}, handlerEmbed);
</script>
{/if}
{if $recaptcha_sitekey != null}
<script src="https://recaptcha.net/recaptcha/api.js" async defer></script>
{/if}

@ -281,12 +281,10 @@
// eof vaildation
{if $geetest_html != null}
if (typeof validate == 'undefined') {
swal('请验证身份', '请滑动验证码来完成验证。', 'error');
return;
}
if (!validate) {
swal('请验证身份', '请滑动验证码来完成验证。', 'error');
validate = captcha.getValidate();
if (typeof validate === 'undefined' || !validate) {
swal('请验证身份', '请滑动验证码来完成验证。', 'info');
$('#register-confirm').removeAttr("disabled","disabled")
return;
}
{/if}
@ -337,7 +335,7 @@
} else {
$('#register-confirm').removeAttr("disabled")
{if $geetest_html != null}
captcha.refresh();
captcha.reset();
{/if}
$("#code").val(code);
swal({

Loading…
Cancel
Save