Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
9 years ago
Commit
a9348cad62657aeaddedcf1d4d931b8f45df231e
1 parent
52b78e08
fix
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
apps/passport/controllers/login.js
config/common.js
apps/passport/controllers/login.js
View file @
a9348ca
...
...
@@ -16,7 +16,7 @@ const config = global.yoho.config;
const
cache
=
global
.
yoho
.
cache
;
const
AuthHelper
=
require
(
'../models/auth-helper'
);
const
PassportHelper
=
require
(
'../models/passport-helper'
);
const
loginPage
=
`
$
{
config
.
siteUrl
}
/passport/
login
`
;
const
loginPage
URL
=
`
$
{
config
.
siteUrl
}
/passport/
login
`
;
// 第三方登录回调
function
doPassportCallback
(
req
,
res
,
user
)
{
...
...
@@ -32,6 +32,7 @@ function doPassportCallback(req, res, user) {
if
(
/sign|login/
.
test
(
refer
))
{
refer
=
config
.
siteUrl
;
}
if
(
user
.
openId
&&
user
.
nickname
)
{
let
signinByOpenID
=
AuthHelper
.
signinByOpenID
(
user
.
nickname
,
user
.
openId
,
user
.
sourceType
,
shoppingKey
,
user
.
unionId
);
...
...
@@ -56,7 +57,7 @@ function doPassportCallback(req, res, user) {
return
res
.
redirect
(
redirectTo
);
});
}
else
{
res
.
redirect
(
loginPage
);
res
.
redirect
(
loginPage
URL
);
}
}
...
...
@@ -203,7 +204,7 @@ const wechat = {
passport
.
authenticate
(
'wechat'
,
(
err
,
user
)
=>
{
if
(
err
)
{
log
.
error
(
`
wechat
authenticate
error
:
$
{
JSON
.
stringify
(
err
)}
`
);
return
res
.
redirect
(
loginPage
);
return
res
.
redirect
(
loginPage
URL
);
}
else
{
doPassportCallback
(
req
,
res
,
{
openId
:
user
.
_json
.
openid
,
...
...
@@ -233,7 +234,7 @@ const sina = {
passport
.
authenticate
(
'sina'
,
(
err
,
user
)
=>
{
if
(
err
)
{
log
.
error
(
`
sina
authenticate
error
:
$
{
JSON
.
stringify
(
err
)}
`
);
return
res
.
redirect
(
loginPage
);
return
res
.
redirect
(
loginPage
URL
);
}
let
nickname
=
user
.
screen_name
;
let
openId
=
user
.
id
;
...
...
@@ -263,7 +264,7 @@ const qq = {
passport
.
authenticate
(
'qq'
,
(
err
,
user
)
=>
{
if
(
err
)
{
log
.
error
(
`
qq
authenticate
error
:
$
{
JSON
.
stringify
(
err
)}
`
);
return
res
.
redirect
(
loginPage
);
return
res
.
redirect
(
loginPage
URL
);
}
let
nickname
=
user
.
nickname
;
let
openId
=
user
.
id
;
...
...
@@ -288,7 +289,7 @@ const alipay = {
passport
.
authenticate
(
'alipay'
,
(
err
,
user
)
=>
{
if
(
err
)
{
log
.
error
(
`
alipay
authenticate
error
:
$
{
JSON
.
stringify
(
err
)}
`
);
return
res
.
redirect
(
loginPage
);
return
res
.
redirect
(
loginPage
URL
);
}
let
nickname
=
user
.
realName
;
let
openId
=
user
.
userId
;
...
...
config/common.js
View file @
a9348ca
...
...
@@ -19,8 +19,8 @@ module.exports = {
},
cookieDomain
:
'yohobuy.com'
,
domains
:
{
api
:
'http://testapi.yoho.cn:28078/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://devservice.yoho.cn:28077/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
api
:
'http://api.yoho.yohoops.org/'
,
service
:
'http://service.yoho.yohoops.org/'
,
search
:
'http://192.168.102.216:8080/yohosearch/'
},
useOneapm
:
false
,
...
...
Please
register
or
login
to post a comment