Authored by htoooth

Merge branch 'hotfix/gee-captcha-check' into gray

... ... @@ -31,7 +31,7 @@ const requiredAPI = (req, res, next) => {
return res.json({
code: 405,
message: '该验证码已失效'
message: '该验证码已失效,请刷新验证码'
});
}
... ... @@ -40,7 +40,7 @@ const requiredAPI = (req, res, next) => {
return next();
} else {
return res.json({
code: 405,
code: 403,
message: '请将图形验证码翻转至正确方向'
});
}
... ... @@ -86,8 +86,8 @@ const checkAPI = (req, res) => {
req.session.captcha = CAPTCHA;
return res.json({
code: 405,
message: '该验证码已失效'
code: 403,
message: '该验证码已失效,请刷新验证码'
});
}
... ...
... ... @@ -859,10 +859,8 @@ function loginAsync() {
location.href = res.data.session;
}
} else {
console.log(res);
if (currentLogin.type() === 'password') {
if (res.code === 405) {
// 极验证提示错误
passwordCaptchaImg.showTip(res.message);
return;
}
... ... @@ -995,9 +993,19 @@ $captchaSmsBtn.on('click', function() {
validateAccount()
.then(validateSmsCaptchaImg)
.then(function() {
disable60sSendSmsBtn();
return sendCaptchaSmsAsync();
}).fail(refreshSmsCaptchaImg);
return sendCaptchaSmsAsync().then(function(res) {
if (res.code === 200) {
smsCaptchaImg.refresh();
return $.Deferred().resolve().promise(); // eslint-disable-line
}
if (res.code === 405) {
smsCaptchaImg.showTip(res.message);
}
return $.Deferred.reject().promise(); // eslint-disable-line
}).then(disable60sSendSmsBtn);
});
});
// 记住登录状态
... ...
... ... @@ -102,7 +102,7 @@ GeeCaptcha.prototype = {
return $.Deferred().reject().promise(); // eslint-disable-line
}
if (!this.checkURI) {
if (!this.checkURI) { // 如果没有跳过网络检查
return $.Deferred().resolve().promise(); // eslint-disable-line
}
... ...
... ... @@ -130,11 +130,15 @@ Captcha.prototype = {
var self = this;
var uri = this.checkURI;
if (self.getResults() === '0000') {
if (self.getResults() === '') {
self.showTip();
return $.Deferred().reject().promise(); // eslint-disable-line
}
if (!self.checkURI) { // 跳过网络检查
return $.Deferred().resolve().promise(); // eslint-disable-line
}
return $.post(uri, {
verifyCode: self.getResults()
}).then(function(result) {
... ...