Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xiaowei
9 years ago
Commit
5a88ddd45a162b95fec31870cc893ce83b046b94
1 parent
ac4c3f85
YBW-3425 登录bug
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Login.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
5a88ddd
...
...
@@ -6,6 +6,7 @@ use LibModels\Web\Passport\LoginData;
use
Passport\PassportModel
as
PassportModel
;
use
Configs\ChannelConfig
;
use
WebPlugin\Helpers
;
use
WebPlugin\Cache
;
class
LoginController
extends
WebAction
{
...
...
@@ -61,8 +62,7 @@ class LoginController extends WebAction
*/
public
function
authAction
()
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'账号或密码不正确'
,
'data'
=>
''
);
$data
=
array
(
'code'
=>
400
,
'message'
=>
'您输入的密码及账户名不匹配,是否忘记密码?'
,
'data'
=>
''
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
...
...
@@ -91,10 +91,29 @@ class LoginController extends WebAction
break
;
}
/*
调用登录接口进行登录
*/
/*
购物车
*/
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
/*
* 登录-防恶意机制
* 同一用户名登录密码错误次数超10次,需30分钟后尝试
* 同一ip登录密码错误次数超100次,需1小时后尝试 , ip错误提示语:您尝试的次数过多,账号已被暂时锁定,请稍后再试
*/
$ip
=
Helpers
::
getClientIp
();
$ipKey
=
md5
(
'ip_signin_'
.
$ip
);
$accountKey
=
md5
(
'account_signin_'
.
$account
);
$accountTimes
=
Cache
::
increment
(
$accountKey
,
1
,
0
,
1800
);
$ipTimes
=
Cache
::
increment
(
$ipKey
,
1
,
0
,
3600
);
if
(
$accountTimes
>
10
)
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'您输入的密码及账户名不匹配,是否忘记密码?'
,
'data'
=>
''
);
break
;
}
if
(
$ipTimes
>
100
)
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'您尝试的次数过多,账号已被暂时锁定,请稍后再试'
,
'data'
=>
''
);
break
;
}
$data
=
LoginData
::
signin
(
$area
,
$account
,
$password
,
$shoppingKey
);
if
(
!
isset
(
$data
[
'code'
])
||
$data
[
'code'
]
!=
200
||
!
isset
(
$data
[
'data'
][
'uid'
]))
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'您输入的密码及账户名不匹配,是否忘记密码?'
,
'data'
=>
''
);
break
;
}
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
View file @
5a88ddd
...
...
@@ -59,7 +59,7 @@ class RegisterController extends WebAction
$data
[
'message'
]
=
'手机号码格式不正确'
;
break
;
}
if
(
$ip_times
>=
10
00
)
{
if
(
$ip_times
>=
5
00
)
{
$data
[
'message'
]
=
'由于你IP受限无法注册'
;
break
;
}
...
...
Please
register
or
login
to post a comment