Authored by 毕凯

Merge branch 'feature/weixinlogin' into 'master'

微信退出后不自动登录



See merge request !428
... ... @@ -78,7 +78,9 @@ const common = {
next();
},
weixinCheck: (req, res, next) => {
if (req.yoho.isWechat) {
let passLogin = _.get(req, 'cookies._WX_PASS_LOGIN', false);
if (req.yoho.isWechat && !passLogin) {
return res.redirect('/passport/login/wechat');
}
next();
... ... @@ -256,10 +258,12 @@ const local = {
domain: 'yohobuy.com'
});
res.clearCookie('_SPK');
res.cookie('_WX_PASS_LOGIN', true, {
domain: 'm.yohobuy.com'
});
let refer = req.get('Referer') || config.siteUrl;
refer = utils.refererLimit(refer);
res.redirect(refer);
}
};
... ... @@ -269,6 +273,9 @@ const wechat = {
// 设置为原链接标识originalUrl
req.session.originalUrl = 'true';
req.session.authState = uuid.v4();
res.clearCookie('_WX_PASS_LOGIN', {
domain: 'm.yohobuy.com'
});
return passport.authenticate('weixin', {
state: req.session.authState
})(req, res, next);
... ...