...
|
...
|
@@ -109,26 +109,21 @@ class LoginController extends WebAction |
|
|
$ip = Helpers::getClientIp();
|
|
|
$ipKey = md5('ip_signin_' . $ip);
|
|
|
$accountKey = md5('account_signin_' . $account);
|
|
|
if (!Cache::get($ipKey)) {
|
|
|
Cache::set($ipKey, 0);
|
|
|
}
|
|
|
if (!Cache::get($accountKey)) {
|
|
|
Cache::set($accountKey, 0);
|
|
|
}
|
|
|
Cache::increment($ipKey, 1, 0, 3600);
|
|
|
PassportModel::increment($ipKey, 1, 0, 3600);
|
|
|
$accountTimes = Cache::get($accountKey);
|
|
|
$ipTimes = Cache::get($ipKey);
|
|
|
if ($accountTimes > 10) {
|
|
|
$data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$ipTimes = Cache::get($ipKey);
|
|
|
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'])) {
|
|
|
Cache::increment($accountKey, 1, 0, 1800);
|
|
|
PassportModel::increment($accountKey, 1, 0, 1800);
|
|
|
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
|
|
|
break;
|
|
|
}
|
...
|
...
|
|