Showing
4 changed files
with
23 additions
and
11 deletions
@@ -31,7 +31,7 @@ const requiredAPI = (req, res, next) => { | @@ -31,7 +31,7 @@ const requiredAPI = (req, res, next) => { | ||
31 | 31 | ||
32 | return res.json({ | 32 | return res.json({ |
33 | code: 405, | 33 | code: 405, |
34 | - message: '该验证码已失效' | 34 | + message: '该验证码已失效,请刷新验证码' |
35 | }); | 35 | }); |
36 | } | 36 | } |
37 | 37 | ||
@@ -40,7 +40,7 @@ const requiredAPI = (req, res, next) => { | @@ -40,7 +40,7 @@ const requiredAPI = (req, res, next) => { | ||
40 | return next(); | 40 | return next(); |
41 | } else { | 41 | } else { |
42 | return res.json({ | 42 | return res.json({ |
43 | - code: 405, | 43 | + code: 403, |
44 | message: '请将图形验证码翻转至正确方向' | 44 | message: '请将图形验证码翻转至正确方向' |
45 | }); | 45 | }); |
46 | } | 46 | } |
@@ -86,8 +86,8 @@ const checkAPI = (req, res) => { | @@ -86,8 +86,8 @@ const checkAPI = (req, res) => { | ||
86 | req.session.captcha = CAPTCHA; | 86 | req.session.captcha = CAPTCHA; |
87 | 87 | ||
88 | return res.json({ | 88 | return res.json({ |
89 | - code: 405, | ||
90 | - message: '该验证码已失效' | 89 | + code: 403, |
90 | + message: '该验证码已失效,请刷新验证码' | ||
91 | }); | 91 | }); |
92 | } | 92 | } |
93 | 93 |
@@ -859,10 +859,8 @@ function loginAsync() { | @@ -859,10 +859,8 @@ function loginAsync() { | ||
859 | location.href = res.data.session; | 859 | location.href = res.data.session; |
860 | } | 860 | } |
861 | } else { | 861 | } else { |
862 | - console.log(res); | ||
863 | if (currentLogin.type() === 'password') { | 862 | if (currentLogin.type() === 'password') { |
864 | if (res.code === 405) { | 863 | if (res.code === 405) { |
865 | - // 极验证提示错误 | ||
866 | passwordCaptchaImg.showTip(res.message); | 864 | passwordCaptchaImg.showTip(res.message); |
867 | return; | 865 | return; |
868 | } | 866 | } |
@@ -995,9 +993,19 @@ $captchaSmsBtn.on('click', function() { | @@ -995,9 +993,19 @@ $captchaSmsBtn.on('click', function() { | ||
995 | validateAccount() | 993 | validateAccount() |
996 | .then(validateSmsCaptchaImg) | 994 | .then(validateSmsCaptchaImg) |
997 | .then(function() { | 995 | .then(function() { |
998 | - disable60sSendSmsBtn(); | ||
999 | - return sendCaptchaSmsAsync(); | ||
1000 | - }).fail(refreshSmsCaptchaImg); | 996 | + return sendCaptchaSmsAsync().then(function(res) { |
997 | + if (res.code === 200) { | ||
998 | + smsCaptchaImg.refresh(); | ||
999 | + return $.Deferred().resolve().promise(); // eslint-disable-line | ||
1000 | + } | ||
1001 | + | ||
1002 | + if (res.code === 405) { | ||
1003 | + smsCaptchaImg.showTip(res.message); | ||
1004 | + } | ||
1005 | + | ||
1006 | + return $.Deferred.reject().promise(); // eslint-disable-line | ||
1007 | + }).then(disable60sSendSmsBtn); | ||
1008 | + }); | ||
1001 | }); | 1009 | }); |
1002 | 1010 | ||
1003 | // 记住登录状态 | 1011 | // 记住登录状态 |
@@ -102,7 +102,7 @@ GeeCaptcha.prototype = { | @@ -102,7 +102,7 @@ GeeCaptcha.prototype = { | ||
102 | return $.Deferred().reject().promise(); // eslint-disable-line | 102 | return $.Deferred().reject().promise(); // eslint-disable-line |
103 | } | 103 | } |
104 | 104 | ||
105 | - if (!this.checkURI) { | 105 | + if (!this.checkURI) { // 如果没有跳过网络检查 |
106 | return $.Deferred().resolve().promise(); // eslint-disable-line | 106 | return $.Deferred().resolve().promise(); // eslint-disable-line |
107 | } | 107 | } |
108 | 108 |
@@ -130,11 +130,15 @@ Captcha.prototype = { | @@ -130,11 +130,15 @@ Captcha.prototype = { | ||
130 | var self = this; | 130 | var self = this; |
131 | var uri = this.checkURI; | 131 | var uri = this.checkURI; |
132 | 132 | ||
133 | - if (self.getResults() === '0000') { | 133 | + if (self.getResults() === '') { |
134 | self.showTip(); | 134 | self.showTip(); |
135 | return $.Deferred().reject().promise(); // eslint-disable-line | 135 | return $.Deferred().reject().promise(); // eslint-disable-line |
136 | } | 136 | } |
137 | 137 | ||
138 | + if (!self.checkURI) { // 跳过网络检查 | ||
139 | + return $.Deferred().resolve().promise(); // eslint-disable-line | ||
140 | + } | ||
141 | + | ||
138 | return $.post(uri, { | 142 | return $.post(uri, { |
139 | verifyCode: self.getResults() | 143 | verifyCode: self.getResults() |
140 | }).then(function(result) { | 144 | }).then(function(result) { |
-
Please register or login to post a comment