...
|
...
|
@@ -9,11 +9,12 @@ const utils = global.yoho.utils; |
|
|
const AuthHelper = require('../models/auth-helper');
|
|
|
const loginPage = `${config.siteUrl}/signin.html`;
|
|
|
|
|
|
function doPassportCallback(openId, nickname, source, req, res) { // eslint-disable-line
|
|
|
function doPassportCallback(openId, nickname, headIcon, source, req, res) { // eslint-disable-line
|
|
|
if (openId && nickname && source) {
|
|
|
req.session._THIRD_LOGIN_INFO = {
|
|
|
openId,
|
|
|
nickname,
|
|
|
headIcon,
|
|
|
source
|
|
|
};
|
|
|
|
...
|
...
|
@@ -154,8 +155,9 @@ const wechat = { |
|
|
callback: (req, res) => {
|
|
|
const openId = req.query.openId;
|
|
|
const nickname = req.query.nickname;
|
|
|
const headIcon = req.query.headImg;
|
|
|
|
|
|
doPassportCallback(openId, nickname, 'wechat', req, res);
|
|
|
doPassportCallback(openId, nickname, headIcon, 'wechat', req, res);
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -172,8 +174,9 @@ const sina = { |
|
|
callback: (req, res) => {
|
|
|
const openId = req.query.openId;
|
|
|
const nickname = req.query.nickname;
|
|
|
const headIcon = req.query.headImg;
|
|
|
|
|
|
doPassportCallback(openId, nickname, 'sina', req, res);
|
|
|
doPassportCallback(openId, nickname, headIcon, 'sina', req, res);
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -201,8 +204,9 @@ const qq = { |
|
|
|
|
|
let nickname = user.nickname;
|
|
|
let openId = user.id;
|
|
|
let headIcon = user._json.figureurl_qq_2 || user._json.figureurl_2;
|
|
|
|
|
|
doPassportCallback(openId, nickname, 'qq', req, res);
|
|
|
doPassportCallback(openId, nickname, headIcon, 'qq', req, res);
|
|
|
})(req, res, next);
|
|
|
} else {
|
|
|
log.error('Auth State Mismatch:' + req.originalUrl);
|
...
|
...
|
|