Showing
1 changed file
with
9 additions
and
2 deletions
@@ -78,7 +78,9 @@ const common = { | @@ -78,7 +78,9 @@ const common = { | ||
78 | next(); | 78 | next(); |
79 | }, | 79 | }, |
80 | weixinCheck: (req, res, next) => { | 80 | weixinCheck: (req, res, next) => { |
81 | - if (req.yoho.isWechat) { | 81 | + let passLogin = _.get(req, 'cookies._WX_PASS_LOGIN', false); |
82 | + | ||
83 | + if (req.yoho.isWechat && !passLogin) { | ||
82 | return res.redirect('/passport/login/wechat'); | 84 | return res.redirect('/passport/login/wechat'); |
83 | } | 85 | } |
84 | next(); | 86 | next(); |
@@ -256,10 +258,12 @@ const local = { | @@ -256,10 +258,12 @@ const local = { | ||
256 | domain: 'yohobuy.com' | 258 | domain: 'yohobuy.com' |
257 | }); | 259 | }); |
258 | res.clearCookie('_SPK'); | 260 | res.clearCookie('_SPK'); |
261 | + res.cookie('_WX_PASS_LOGIN', true, { | ||
262 | + domain: 'm.yohobuy.com' | ||
263 | + }); | ||
259 | let refer = req.get('Referer') || config.siteUrl; | 264 | let refer = req.get('Referer') || config.siteUrl; |
260 | 265 | ||
261 | refer = utils.refererLimit(refer); | 266 | refer = utils.refererLimit(refer); |
262 | - | ||
263 | res.redirect(refer); | 267 | res.redirect(refer); |
264 | } | 268 | } |
265 | }; | 269 | }; |
@@ -269,6 +273,9 @@ const wechat = { | @@ -269,6 +273,9 @@ const wechat = { | ||
269 | // 设置为原链接标识originalUrl | 273 | // 设置为原链接标识originalUrl |
270 | req.session.originalUrl = 'true'; | 274 | req.session.originalUrl = 'true'; |
271 | req.session.authState = uuid.v4(); | 275 | req.session.authState = uuid.v4(); |
276 | + res.clearCookie('_WX_PASS_LOGIN', { | ||
277 | + domain: 'm.yohobuy.com' | ||
278 | + }); | ||
272 | return passport.authenticate('weixin', { | 279 | return passport.authenticate('weixin', { |
273 | state: req.session.authState | 280 | state: req.session.authState |
274 | })(req, res, next); | 281 | })(req, res, next); |
-
Please register or login to post a comment