|
|
|
|
|
const _ = require('lodash');
|
|
|
const url = require('url');
|
|
|
const uuid = require('uuid');
|
|
|
const passport = require('passport');
|
|
|
const TaobaoStrategy = require('./passport-taobao');
|
...
|
...
|
@@ -150,7 +149,7 @@ const login = { |
|
|
|
|
|
if (result.code === 200) {
|
|
|
if (_.get(result, 'data.is_bind') === 'N') {
|
|
|
redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
|
|
|
redirectUrl = req.cookies.third_backurl ? req.cookies.third_backurl : homePage;
|
|
|
redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?';
|
|
|
redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`));
|
|
|
} else if (+_.get(result, 'data.uid') > 0) {
|
...
|
...
|
@@ -160,7 +159,7 @@ const login = { |
|
|
req,
|
|
|
res
|
|
|
}).finally(() => {
|
|
|
let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
|
|
|
let refer = req.cookies.third_backurl ? req.cookies.third_backurl : homePage;
|
|
|
|
|
|
return res.redirect(refer);
|
|
|
});
|
...
|
...
|
|