Showing
1 changed file
with
7 additions
and
12 deletions
@@ -33,23 +33,17 @@ function doPassportCallback(req, res, user) { | @@ -33,23 +33,17 @@ function doPassportCallback(req, res, user) { | ||
33 | refer = config.siteUrl; | 33 | refer = config.siteUrl; |
34 | } | 34 | } |
35 | if (user.openId) { | 35 | if (user.openId) { |
36 | - let signinByOpenID; | ||
37 | - | ||
38 | user.nickname = _.trim(user.nickname); | 36 | user.nickname = _.trim(user.nickname); |
39 | 37 | ||
40 | if (user.sourceType === 'wechat') { | 38 | if (user.sourceType === 'wechat') { |
41 | - | ||
42 | - // PC 的微信登录之前使用了 open_id, 所以需要特别的接口处理 | ||
43 | - signinByOpenID = AuthHelper.signinByWechat( | ||
44 | - user.nickname, user.openId, user.unionId, user.sourceType, shoppingKey); | ||
45 | - } else { | ||
46 | - signinByOpenID = AuthHelper.signinByOpenID( | ||
47 | - user.nickname, user.openId, user.sourceType, shoppingKey); | 39 | + // PC 的微信登录使用unionId |
40 | + user.openId = user.unionId; | ||
48 | } | 41 | } |
49 | 42 | ||
50 | - return signinByOpenID.then((result) => { | 43 | + return AuthHelper.signinByOpenID(user.nickname, user.openId, user.sourceType, shoppingKey) |
44 | + .then((result) => { | ||
51 | if (result.code !== 200) { | 45 | if (result.code !== 200) { |
52 | - return Promise.reject(result); | 46 | + return res.redirect(config.siteUrl); |
53 | } | 47 | } |
54 | if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line | 48 | if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line |
55 | return helpers.urlFormat('/passport/thirdlogin/index', { | 49 | return helpers.urlFormat('/passport/thirdlogin/index', { |
@@ -62,7 +56,8 @@ function doPassportCallback(req, res, user) { | @@ -62,7 +56,8 @@ function doPassportCallback(req, res, user) { | ||
62 | return refer; | 56 | return refer; |
63 | }); | 57 | }); |
64 | } | 58 | } |
65 | - }).then((redirectTo) => { | 59 | + }) |
60 | + .then((redirectTo) => { | ||
66 | return res.redirect(redirectTo); | 61 | return res.redirect(redirectTo); |
67 | }); | 62 | }); |
68 | } else { | 63 | } else { |
-
Please register or login to post a comment