Authored by htoooth

fix

... ... @@ -29,14 +29,18 @@ const checkAPI = (req, res) => {
};
const passwordRequired = (req, res, next) => {
// 默认账户密码登录需要验证码
// if (req.session.type === 'needCaptcha' && req.body.loginType === 'password') {
if (req.body.loginType === 'password') {
return requiredAPI(req, res, next);
if (_.get(req.app.pc, 'password.alwaysNeedCaptcha', false)) {
if (req.body.loginType === 'password') {
return requiredAPI(req, res, next);
}
} else {
return next();
if (req.session.type === 'needCaptcha' && req.body.loginType === 'password') {
return requiredAPI(req, res, next);
}
}
return next();
};
const tryGeetest = (req, res, next) => {
... ...
... ... @@ -2,3 +2,7 @@
<script>window._geeCaptcha = true;</script>
<script src="https://static.geetest.com/static/tools/gt.js"></script>
{{/if}}
{{#if @root.pc.password.alwaysNeedCaptcha}}
<script>window._passwordCaptcha = true;</script>
{{/if}}
... ...
... ... @@ -56,7 +56,7 @@ var $accountInput1 = $('#account1'),
// 图像验证码
$passwordCaptchaWrap = $('.captcha-wrap'),
passwordCaptchaImg = new Captcha('.captcha-wrap', {checkURI: ''}).init(),
isShowCaptchaImg = true,
isShowCaptchaImg = window._passwordCaptcha || false,
getPasswordCaptchaImgVal = function() {
if (isShowCaptchaImg) {
return passwordCaptchaImg.getResults();
... ...