Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
7 years ago
Commit
7a30aba114f7c7b246c0df654129f1ea94aad632
1 parent
c005376a
superCapture
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
12 deletions
apps/passport/auth.js
apps/passport/controllers/bind.js
apps/passport/controllers/reg.js
apps/passport/controllers/sms.js
apps/passport/models/auth-helper.js
apps/passport/models/bind-service.js
apps/passport/models/phone-service.js
apps/passport/models/reg-service.js
config/common.js
apps/passport/auth.js
View file @
7a30aba
...
...
@@ -39,6 +39,7 @@ passport.use(new LocalStrategy({
let
from
=
req
.
cookies
.
from
||
'yohobuy'
;
let
udid
=
req
.
sessionID
;
let
captcha
=
req
.
body
.
captcha
;
let
superCapture
=
''
;
if
(
isNaN
(
parseInt
(
area
,
0
))
||
_
.
isEmpty
(
username
)
||
_
.
isEmpty
(
password
))
{
logger
.
info
(
`【
Passport
Login
】
bad
params
,
area
:
$
{
area
}
account
:
$
{
username
}
password
:
$
{
password
}
`
);
...
...
@@ -64,7 +65,8 @@ passport.use(new LocalStrategy({
let
shoppingKey
=
cookie
.
getShoppingKey
(
req
);
if
(
req
.
body
.
geetest_challenge
)
{
captcha
=
req
.
body
.
geetest_challenge
;
// TODO 使用极验证传特殊的值
captcha
=
''
;
superCapture
=
config
.
superCapture
;
}
req
.
ctx
(
AuthHelperModel
).
signinAes
({
...
...
@@ -76,7 +78,8 @@ passport.use(new LocalStrategy({
isSkip
,
from
,
udid
,
degrees
:
captcha
degrees
:
captcha
,
superCapture
}).
then
((
result
)
=>
{
logger
.
info
(
`
login
result
:
$
{
JSON
.
stringify
(
result
)}
`
);
...
...
apps/passport/controllers/bind.js
View file @
7a30aba
...
...
@@ -8,6 +8,7 @@
'use strict'
;
const
helpers
=
global
.
yoho
.
helpers
;
const
config
=
global
.
yoho
.
config
;
const
RegServiceModel
=
require
(
'../models/reg-service'
);
const
BindServiceModel
=
require
(
'../models/bind-service'
);
const
AuthHelperModel
=
require
(
'../models/auth-helper'
);
...
...
@@ -129,16 +130,19 @@ const bind = {
let
areaCode
=
req
.
body
.
areaCode
||
'86'
;
let
udid
=
req
.
sessionID
;
let
captcha
=
req
.
body
.
captcha
;
let
superCapture
=
''
;
if
(
req
.
xhr
&&
_
.
isNumber
(
parseInt
(
phoneNum
,
0
))
&&
areaCode
)
{
if
(
req
.
body
.
geetest_challenge
)
{
captcha
=
req
.
body
.
geetest_challenge
;
// TODO 使用极验证传特殊的值
captcha
=
''
;
superCapture
=
config
.
superCapture
;
}
req
.
ctx
(
BindServiceModel
).
sendBindMsg
({
area
:
areaCode
,
mobile
:
phoneNum
,
udid
,
captcha
captcha
,
superCapture
}).
then
(
result
=>
{
if
(
result
&&
result
.
code
)
{
res
.
json
(
result
);
...
...
apps/passport/controllers/reg.js
View file @
7a30aba
...
...
@@ -7,6 +7,7 @@ const sign = global.yoho.sign;
const
co
=
require
(
'bluebird'
).
coroutine
;
const
cookie
=
global
.
yoho
.
cookie
;
const
AuthHelperModel
=
require
(
'../models/auth-helper'
);
const
config
=
global
.
yoho
.
config
;
class
Reg
{
/**
...
...
@@ -179,6 +180,7 @@ class Reg {
let
inviteCode
=
req
.
body
.
inviteCode
||
''
;
let
udid
=
req
.
sessionID
;
let
captcha
=
req
.
body
.
captcha
;
let
superCapture
=
''
;
// 判断参数是否合法
if
(
!
_
.
isNumber
(
mobile
)
||
!
_
.
isNumber
(
area
))
{
...
...
@@ -187,12 +189,13 @@ class Reg {
}
if
(
req
.
body
.
geetest_challenge
)
{
captcha
=
req
.
body
.
geetest_challenge
;
// TODO 使用极验证传特殊的值
captcha
=
''
;
superCapture
=
config
.
superCapture
;
}
// 向手机发送注册验证码
req
.
ctx
(
RegServiceModel
).
sendCodeToMobile
({
area
,
mobile
,
udid
,
captcha
area
,
mobile
,
udid
,
captcha
,
superCapture
}).
then
((
result
)
=>
{
if
(
result
.
code
!==
200
)
{
data
.
message
=
result
.
message
;
...
...
apps/passport/controllers/sms.js
View file @
7a30aba
...
...
@@ -4,6 +4,7 @@ const _ = require('lodash');
const
co
=
Promise
.
coroutine
;
const
moment
=
require
(
'moment'
);
const
cookie
=
global
.
yoho
.
cookie
;
const
config
=
global
.
yoho
.
config
;
const
utils
=
require
(
global
.
utils
);
const
RegServiceModel
=
require
(
'../models/reg-service'
);
const
PhoneServiceModel
=
require
(
'../models/phone-service'
);
...
...
@@ -81,7 +82,8 @@ class SmsLogin {
};
if
(
req
.
body
.
geetest_challenge
)
{
params
.
captcha
=
req
.
body
.
geetest_challenge
;
// TODO 使用极验证传特殊的值
params
.
captcha
=
''
;
params
.
superCapture
=
config
.
superCapture
;
}
co
(
function
*
()
{
...
...
apps/passport/models/auth-helper.js
View file @
7a30aba
...
...
@@ -43,7 +43,8 @@ class AuthModel extends global.yoho.BaseModel {
business_line
:
FROM
[
params
.
from
].
business_line
,
udid
:
params
.
udid
,
fromPage
:
PAGE
,
degrees
:
params
.
degrees
degrees
:
params
.
degrees
,
superCapture
:
params
.
superCapture
};
if
(
params
.
shoppingKey
)
{
...
...
apps/passport/models/bind-service.js
View file @
7a30aba
...
...
@@ -35,7 +35,8 @@ class BindServiceModel extends global.yoho.BaseModel {
area
:
params
.
area
,
udid
:
params
.
udid
,
degrees
:
params
.
captcha
,
fromPage
:
PAGE
fromPage
:
PAGE
,
superCapture
:
params
.
superCapture
}
});
}
...
...
apps/passport/models/phone-service.js
View file @
7a30aba
...
...
@@ -47,7 +47,8 @@ class PhoneServiceModel extends global.yoho.BaseModel {
type
:
params
.
type
,
udid
:
params
.
udid
,
fromPage
:
PAGE
,
degrees
:
params
.
captcha
degrees
:
params
.
captcha
,
superCapture
:
params
.
superCapture
}
});
}
...
...
apps/passport/models/reg-service.js
View file @
7a30aba
...
...
@@ -75,7 +75,8 @@ class RegServiceModel extends global.yoho.BaseModel {
mobile
:
params
.
mobile
,
udid
:
params
.
udid
,
fromPage
:
PAGE
,
degrees
:
params
.
captcha
degrees
:
params
.
captcha
,
superCapture
:
params
.
superCapture
}});
}
...
...
config/common.js
View file @
7a30aba
...
...
@@ -128,7 +128,8 @@ module.exports = {
return
Math
.
min
(
options
.
attempt
*
100
,
1000
);
}
}
}
},
superCapture
:
'93c70db61fe276f93ce781ad17dc47cd'
};
if
(
isProduction
)
{
...
...
Please
register
or
login
to post a comment