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
陈轩
8 years ago
Commit
98749542f02f25a56bd980f00458b850a7d5e8ec
1 parent
3b23900a
fix
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
21 deletions
apps/passport/controllers/back.js
apps/passport/controllers/login.js
apps/passport/controllers/sms.js
apps/passport/controllers/back.js
View file @
9874954
...
...
@@ -230,7 +230,7 @@ const sendCodeToMobileAPI = (req, res, next) => {
};
if
(
req
.
session
.
captchaValidCount
===
0
)
{
req
.
session
.
captcha
=
void
0
;
// 验证码 用过就扔
req
.
session
.
captcha
=
null
;
// 验证码 用过就扔
jsonData
.
changeCaptcha
=
true
;
}
...
...
apps/passport/controllers/login.js
View file @
9874954
...
...
@@ -161,31 +161,30 @@ const local = {
if
(
count
==
null
)
{
// eslint-disable-line
_
.
set
(
req
.
session
,
'login.errorCount'
,
3
);
}
else
if
(
count
<=
0
)
{
}
if
(
count
<=
0
)
{
let
captchaInput
=
req
.
body
.
captcha
;
let
captchaCode
=
_
.
get
(
req
.
session
,
'captcha'
);
let
errorCount
=
_
.
get
(
req
.
session
,
'captchaValidCount'
,
4
);
// 初始1次 + 后续4次, 同一个验证码 共5次
let
errorCount
=
_
.
get
(
req
.
session
,
'captchaValidCount'
);
// 初始1次 + 后续4次, 同一个验证码 共5次
if
(
!
errorCount
)
{
_
.
set
(
req
.
session
,
'captchaValidCount'
,
4
);
}
else
{
--
req
.
session
.
captchaValidCount
;
}
if
(
!
captchaInput
||
!
captchaCode
||
captchaInput
!==
captchaCode
)
{
let
jsonData
=
{
code
:
400
,
message
:
'请将图片旋转到正确方向'
,
captchaShow
:
true
};
let
jsonData
=
{
code
:
400
,
message
:
'请将图片旋转到正确方向'
,
captchaShow
:
true
};
--
req
.
session
.
captchaValidCount
;
if
(
req
.
session
.
captchaValidCount
===
0
)
{
req
.
session
.
captcha
=
void
0
;
// 验证码 用过就扔
jsonData
.
changeCaptcha
=
true
;
}
if
(
!
errorCount
)
{
_
.
set
(
req
.
session
,
'captchaValidCount'
,
5
);
// delete req.session.captcha; // 验证码 用过就扔
req
.
session
.
captcha
=
null
;
jsonData
.
changeCaptcha
=
true
;
}
if
(
!
(
captchaInput
&&
captchaCode
&&
captchaInput
===
captchaCode
))
{
res
.
json
(
jsonData
);
return
;
...
...
apps/passport/controllers/sms.js
View file @
9874954
...
...
@@ -162,7 +162,7 @@ exports.indexCheck = (req, res, next) => {
// 校验 失败
em
.
on
(
'reject'
,
error
=>
{
if
(
req
.
session
.
captchaValidCount
===
0
)
{
req
.
session
.
captcha
=
void
0
;
// 验证码 用过就扔
req
.
session
.
captcha
=
null
;
// 验证码 用过就扔
error
.
changeCaptcha
=
true
;
}
...
...
@@ -178,7 +178,7 @@ exports.indexCheck = (req, res, next) => {
return
em
.
emit
(
'reject'
,
{
code
:
400
,
message
:
'请填写手机号'
});
}
else
if
(
!
captcode
)
{
return
em
.
emit
(
'reject'
,
{
code
:
400
,
message
:
'请填写验证码'
});
}
else
if
(
captcode
!==
captcodeValid
)
{
}
else
if
(
!
(
captcodeValid
&&
captcode
===
captcodeValid
)
)
{
return
em
.
emit
(
'reject'
,
{
code
:
400
,
message
:
'请将图片旋转到正确位置'
});
}
...
...
Please
register
or
login
to post a comment