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
bb3d181cddfed778cfd2ecb332601a2b46035472
1 parent
69b35eba
移除ip限制
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
14 deletions
apps/passport/models/login-auth-service.js
apps/passport/views/action/login/index.hbs
config/common.js
apps/passport/models/login-auth-service.js
View file @
bb3d181
...
...
@@ -63,23 +63,18 @@ passport.use(new LocalStrategy({
let
shoppingKey
=
cookie
.
getShoppingKey
(
req
);
let
account
=
req
.
body
.
account
;
let
ip
=
req
.
ip
;
let
errorLoginKey
=
'account_errorlogin_'
+
account
;
let
accountKey
=
'account_signin_'
+
account
;
let
ipKey
=
'ip_signin_'
+
ip
;
let
cacheGet
=
[
cache
.
get
(
errorLoginKey
),
cache
.
get
(
accountKey
)
,
cache
.
get
(
ipKey
)
];
let
cacheGet
=
[
cache
.
get
(
errorLoginKey
),
cache
.
get
(
accountKey
)];
Promise
.
all
(
cacheGet
).
then
(
times
=>
{
let
errLoginTimes
=
_
.
parseInt
(
times
[
0
])
||
0
;
let
accountTimes
=
_
.
parseInt
(
times
[
1
])
||
0
;
let
ipTimes
=
_
.
parseInt
(
times
[
2
])
||
0
;
if
(
accountTimes
>=
10
)
{
done
({
message
:
'您的账号已被暂时锁定,请稍后再试'
},
null
);
}
else
if
(
ipTimes
>=
100
)
{
done
({
message
:
'您尝试的次数过多,账号已被暂时锁定,请稍后再试'
},
null
);
done
({
message
:
'您的账号已被暂时锁定,请30分钟后再试'
},
null
);
}
else
{
return
loginService
.
signin
(
area
,
username
,
password
,
shoppingKey
).
then
((
result
)
=>
{
if
(
result
.
code
&&
result
.
code
===
200
&&
result
.
data
.
uid
)
{
...
...
@@ -89,15 +84,11 @@ passport.use(new LocalStrategy({
}
else
{
errLoginTimes
=
errLoginTimes
+
1
;
accountTimes
=
accountTimes
+
1
;
ipTimes
=
ipTimes
+
1
;
cache
.
set
(
errorLoginKey
,
errLoginTimes
);
cache
.
set
(
accountKey
,
accountTimes
,
1800
);
cache
.
set
(
ipKey
,
ipTimes
,
3600
);
// 再次校验
if
(
ipTimes
>=
100
)
{
done
({
message
:
'您尝试的次数过多,账号已被暂时锁定,请稍后再试'
},
null
);
}
else
if
(
accountTimes
>=
10
)
{
if
(
accountTimes
>=
10
)
{
done
({
message
:
'您的账号已被暂时锁定,请稍后再试'
},
null
);
}
else
if
(
errLoginTimes
>=
3
)
{
done
({
...
...
apps/passport/views/action/login/index.hbs
View file @
bb3d181
...
...
@@ -48,7 +48,7 @@
<li
class=
"clearfix"
>
<span
class=
"left login-fail-tip hide"
>
<
!--<span class="'iconfont"></span>--
>
<
span
class=
"iconfont"
>

</span
>
<em></em>
</span>
...
...
config/common.js
View file @
bb3d181
...
...
@@ -19,7 +19,7 @@ module.exports = {
},
cookieDomain
:
'yohobuy.com'
,
domains
:
{
api
:
'http://
devapi.yoho.cn:5
8078/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
api
:
'http://
testapi.yoho.cn:2
8078/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://testservice.yoho.cn:28077/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
search
:
'http://192.168.102.216:8080/yohosearch/'
},
...
...
Please
register
or
login
to post a comment