Showing
6 changed files
with
24 additions
and
10 deletions
@@ -191,7 +191,7 @@ const local = { | @@ -191,7 +191,7 @@ const local = { | ||
191 | res.clearCookie('_g'); | 191 | res.clearCookie('_g'); |
192 | res.clearCookie('isRemember'); | 192 | res.clearCookie('isRemember'); |
193 | res.clearCookie('remem'); | 193 | res.clearCookie('remem'); |
194 | - res.redirect(req.get('Referer') || config.siteUrl); | 194 | + res.redirect(config.siteUrl); |
195 | } | 195 | } |
196 | }; | 196 | }; |
197 | 197 |
@@ -14,9 +14,18 @@ module.exports = (req, res, next) => { | @@ -14,9 +14,18 @@ module.exports = (req, res, next) => { | ||
14 | return req.protocol + '://' + req.get('host') + req.originalUrl; | 14 | return req.protocol + '://' + req.get('host') + req.originalUrl; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | + let loginUrl = helpers.urlFormat('/passport/login', {refer: req.getUrl()}); | ||
18 | + | ||
17 | if (_.isEmpty(req.user) || !req.user.uid) { | 19 | if (_.isEmpty(req.user) || !req.user.uid) { |
18 | - return res.redirect(helpers.urlFormat('/passport/login', {refer: req.getUrl()})); | ||
19 | - } | 20 | + if (req.xhr) { |
21 | + return res.json({ | ||
22 | + code: 400, | ||
23 | + message: '抱歉,您暂未登录!', | ||
24 | + data: {refer: loginUrl} | ||
25 | + }); | ||
26 | + } | ||
20 | 27 | ||
28 | + return res.redirect(loginUrl); | ||
29 | + } | ||
21 | next(); | 30 | next(); |
22 | }; | 31 | }; |
@@ -133,7 +133,8 @@ $phoneNumInput.on('blur', function() { | @@ -133,7 +133,8 @@ $phoneNumInput.on('blur', function() { | ||
133 | 133 | ||
134 | // 这里只做中国区验证 | 134 | // 这里只做中国区验证 |
135 | if ($regionCodeText.text() === '+86') { | 135 | if ($regionCodeText.text() === '+86') { |
136 | - if ($phoneNumInput.length === 11 && phoneRegx['+86'].test($phoneNumInput.val())) { | 136 | + |
137 | + if (length === 11 && phoneRegx['+86'].test($phoneNumInput.val())) { | ||
137 | ep.emit('phoneNum', true); | 138 | ep.emit('phoneNum', true); |
138 | return; | 139 | return; |
139 | } else { | 140 | } else { |
@@ -42,6 +42,9 @@ require('yoho-jquery-placeholder'); | @@ -42,6 +42,9 @@ require('yoho-jquery-placeholder'); | ||
42 | require('../../plugins/tips'); | 42 | require('../../plugins/tips'); |
43 | 43 | ||
44 | function errTip(ele, msg) { | 44 | function errTip(ele, msg) { |
45 | + | ||
46 | + //ele.tips('show', msg) | ||
47 | + | ||
45 | var topLeft = ele.offset(); | 48 | var topLeft = ele.offset(); |
46 | 49 | ||
47 | $errMsg.text(msg); | 50 | $errMsg.text(msg); |
@@ -244,14 +247,15 @@ function validatePhoneNumLocal() { | @@ -244,14 +247,15 @@ function validatePhoneNumLocal() { | ||
244 | regionCode = $regionCodeText.text(); | 247 | regionCode = $regionCodeText.text(); |
245 | 248 | ||
246 | if (length === 0) { | 249 | if (length === 0) { |
250 | + errTip($phone, '请输入手机号码'); | ||
247 | return false; | 251 | return false; |
248 | } | 252 | } |
249 | 253 | ||
250 | - if (/^[0-9]+$/.test($phoneNumInput.val())) { | 254 | + if (/^[0-9]+$/.test(phoneNum)) { |
251 | 255 | ||
252 | // 这里只做中国区验证 | 256 | // 这里只做中国区验证 |
253 | if (regionCode === '+86') { | 257 | if (regionCode === '+86') { |
254 | - if (phoneNum.length === 11 && regValidate.phoneRegx['+86'].test(phoneNum.val())) { | 258 | + if (length === 11 && regValidate.phoneRegx['+86'].test(phoneNum)) { |
255 | return true; | 259 | return true; |
256 | } else { | 260 | } else { |
257 | errTip($phone, '手机号码不正确,请重新输入'); | 261 | errTip($phone, '手机号码不正确,请重新输入'); |
@@ -333,7 +337,7 @@ function validatePassword() { | @@ -333,7 +337,7 @@ function validatePassword() { | ||
333 | function validatePasswordComplexLocal($obj) { | 337 | function validatePasswordComplexLocal($obj) { |
334 | var pwd = $obj.val(), | 338 | var pwd = $obj.val(), |
335 | level = computeComplex(pwd); | 339 | level = computeComplex(pwd); |
336 | - console.log(level); | 340 | + |
337 | switch (level) { | 341 | switch (level) { |
338 | case 0: | 342 | case 0: |
339 | $pwdParent.removeClass('red yellow green'); | 343 | $pwdParent.removeClass('red yellow green'); |
@@ -27,7 +27,7 @@ var jQuery = require('yoho-jquery'), | @@ -27,7 +27,7 @@ var jQuery = require('yoho-jquery'), | ||
27 | } else { | 27 | } else { |
28 | _that.isInit = true; | 28 | _that.isInit = true; |
29 | this.append(tplFn({content: arguments[0]})); | 29 | this.append(tplFn({content: arguments[0]})); |
30 | - $tips = this.find('.tips'); | 30 | + $tips = this.find('.tips').removeClass('hide'); |
31 | $tips.css({ | 31 | $tips.css({ |
32 | top: topLeft.top + this.height() - 2, | 32 | top: topLeft.top + this.height() - 2, |
33 | left: topLeft.left, | 33 | left: topLeft.left, |
@@ -36,7 +36,7 @@ var jQuery = require('yoho-jquery'), | @@ -36,7 +36,7 @@ var jQuery = require('yoho-jquery'), | ||
36 | }); | 36 | }); |
37 | } | 37 | } |
38 | 38 | ||
39 | - return this.removeClass('hide'); | 39 | + return this; |
40 | }, | 40 | }, |
41 | hide: function() { | 41 | hide: function() { |
42 | if (_that.isInit) { | 42 | if (_that.isInit) { |
-
Please register or login to post a comment