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
Plain Diff
Browse Files
Authored by
陈峰
8 years ago
Commit
06ed172d335e0379d5f7a7f6bea4f08bc6674c64
2 parents
1af3980e
1fb4bd65
Merge branch 'feature/superpwd' into 'gray'
geetest增加超级密码 See merge request
!400
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
apps/passport/controllers/geetest.js
public/js/plugin/validata.js
apps/passport/controllers/geetest.js
View file @
06ed172
...
...
@@ -2,6 +2,7 @@
const
_
=
require
(
'lodash'
);
const
Geetest
=
require
(
'geetest'
);
const
logger
=
global
.
yoho
.
logger
;
const
config
=
global
.
yoho
.
config
;
const
captcha
=
new
Geetest
({
geetest_id
:
'bce95d796bc3058615fdf2ec2c0aef29'
,
...
...
@@ -26,7 +27,8 @@ const geetest = {
validate
(
req
,
res
,
next
)
{
let
challenge
=
req
.
body
.
geetest_challenge
,
validate
=
req
.
body
.
geetest_validate
,
seccode
=
req
.
body
.
geetest_seccode
;
seccode
=
req
.
body
.
geetest_seccode
,
testCode
=
req
.
body
.
yohobuy
;
let
errRes
=
{
code
:
400
,
...
...
@@ -35,6 +37,10 @@ const geetest = {
changeCaptcha
:
true
};
if
(
testCode
===
config
.
testCode
)
{
return
next
();
}
// 使用极验证
let
useGeetest
=
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'geetest.validation'
,
false
);
...
...
public/js/plugin/validata.js
View file @
06ed172
...
...
@@ -37,6 +37,7 @@ class Validate {
},
(
captchaObj
)
=>
{
this
.
captchaObj
=
captchaObj
;
captchaObj
.
appendTo
(
$
(
'#js-img-check'
));
$
(
'#js-img-check'
).
after
(
'<input id="yohobuy" type="text" style="display:none;">'
);
this
.
_atWorking
=
true
;
$
(
'#js-img-check'
).
addClass
(
'hide'
).
addClass
(
'popup'
);
});
...
...
@@ -72,6 +73,9 @@ class Validate {
if
(
this
.
type
===
validType
.
IMG_CHECK
)
{
return
this
.
imgCheck
.
getResults
();
}
else
{
if
(
$
(
'#yohobuy'
).
val
())
{
return
''
;
}
return
new
Promise
((
resolve
)
=>
{
$
(
'#js-img-check'
).
removeClass
(
'hide'
);
this
.
captchaObj
.
onSuccess
(()
=>
{
...
...
Please
register
or
login
to post a comment