Authored by 周少峰

Merge branch 'hotfix/login_qq' into release/1019

... ... @@ -33,23 +33,17 @@ function doPassportCallback(req, res, user) {
refer = config.siteUrl;
}
if (user.openId) {
let signinByOpenID;
user.nickname = _.trim(user.nickname);
if (user.sourceType === 'wechat') {
// PC 的微信登录之前使用了 open_id, 所以需要特别的接口处理
signinByOpenID = AuthHelper.signinByWechat(
user.nickname, user.openId, user.unionId, user.sourceType, shoppingKey);
} else {
signinByOpenID = AuthHelper.signinByOpenID(
user.nickname, user.openId, user.sourceType, shoppingKey);
// PC 的微信登录使用unionId
user.openId = user.unionId;
}
return signinByOpenID.then((result) => {
return AuthHelper.signinByOpenID(user.nickname, user.openId, user.sourceType, shoppingKey)
.then((result) => {
if (result.code !== 200) {
return Promise.reject(result);
return res.redirect(config.siteUrl);
}
if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line
return helpers.urlFormat('/passport/thirdlogin/index', {
... ... @@ -62,7 +56,8 @@ function doPassportCallback(req, res, user) {
return refer;
});
}
}).then((redirectTo) => {
})
.then((redirectTo) => {
return res.redirect(redirectTo);
});
} else {
... ...