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
Plain Diff
Browse Files
Authored by
shijian
8 years ago
Commit
dc2d53596b4b9ede6f96f6660a68ba92ae9f7876
2 parents
2f00eb05
e7df29e6
Merge branch 'feature/safe-bug' of
http://git.yoho.cn/fe/yoho-blk
into feature/safe-bug
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
apps/passport/controllers/captcha.js
apps/passport/controllers/login.js
apps/passport/router.js
public/js/passport/login/index.js
apps/passport/controllers/captcha.js
View file @
dc2d535
...
...
@@ -97,9 +97,25 @@ const requiredPost = (req, res) => {
}
};
const
checkSendMobile
=
(
req
,
res
)
=>
{
if
(
req
.
session
.
sendMobile
&&
req
.
session
.
sendMobile
!==
req
.
query
.
mobile
)
{
req
.
session
.
sendMobile
=
''
;
return
res
.
json
({
code
:
400
,
message
:
'验证码已失效'
});
}
else
{
return
res
.
json
({
code
:
200
,
data
:
{}
})
}
}
module
.
exports
=
{
requiredAPI
,
requiredPage
,
generate
,
requiredPost
requiredPost
,
checkSendMobile
};
...
...
apps/passport/controllers/login.js
View file @
dc2d535
...
...
@@ -243,6 +243,10 @@ const local = {
}
LoginService
.
sendPasswordBySMS
(
area
,
mobile
).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
req
.
session
.
sendMobile
=
mobile
;
}
return
res
.
json
(
result
);
}).
catch
(
next
);
},
...
...
apps/passport/router.js
View file @
dc2d535
...
...
@@ -159,4 +159,6 @@ router.get('/back/resetSuccess',
router
.
get
(
'/images'
,
captcha
.
generate
);
router
.
post
(
'/images/check'
,
captcha
.
requiredPost
);
router
.
get
(
'/captcha/checkSendMobile'
,
captcha
.
checkSendMobile
);
module
.
exports
=
router
;
...
...
public/js/passport/login/index.js
View file @
dc2d535
...
...
@@ -48,7 +48,7 @@ var upDown = {
var
selectedIcon
=
''
;
// 短信验证码的计数器,60s
var
secondCount
=
60
;
var
secondCount
=
5
;
// 短信验证码只能验证一次
var
isSmsCheckedSuccessFlag
=
false
;
...
...
@@ -486,7 +486,7 @@ ep.on('smsCode', function(auth) {
function
disable60sSendSmsBtn
()
{
secondCount
-=
1
;
if
(
secondCount
<
0
)
{
secondCount
=
60
;
secondCount
=
5
;
$smsBtn
.
val
(
'获取短信验证码'
)
.
removeClass
(
'second-progress'
)
.
removeClass
(
'disable'
);
...
...
@@ -659,6 +659,26 @@ $smsBtn.on('mousedown', function() {
return
validateCaptchaImg
(
true
);
})
.
then
(
function
()
{
var
defer
=
$
.
Deferred
();
return
$
.
ajax
({
type
:
'GET'
,
url
:
'/passport/captcha/checkSendMobile'
,
data
:
{
mobile
:
getMoblie
()
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
400
)
{
errTip
(
$imgCaptchaInput
,
data
.
message
);
ep
.
emit
(
'captcha'
,
false
);
refreshCaptcha
();
return
defer
.
reject
(
false
);
}
else
{
return
true
;
}
});
})
.
then
(
function
()
{
disable60sSendSmsBtn
();
return
sendCaptchaSmsAsync
();
});
...
...
Please
register
or
login
to post a comment