|
|
@ -96,8 +96,12 @@ class Login extends Base { |
|
|
return $this->buildFailed(ReturnCode::LOGIN_ERROR, '用户已被封禁,请联系管理员'); |
|
|
return $this->buildFailed(ReturnCode::LOGIN_ERROR, '用户已被封禁,请联系管理员'); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
$this->setFailKey($username); |
|
|
$count = $this->setFailKey($username); |
|
|
return $this->buildFailed(ReturnCode::LOGIN_ERROR, '用户名密码不正确'); |
|
|
return $this->buildFailed( |
|
|
|
|
|
ReturnCode::LOGIN_ERROR, |
|
|
|
|
|
'用户名密码不正确', |
|
|
|
|
|
['need_captcha' => $count >= $this->captchaThreshold] |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
$userInfo['access'] = $this->getAccess($userInfo['id']); |
|
|
$userInfo['access'] = $this->getAccess($userInfo['id']); |
|
|
$userInfo['menu'] = $this->getAccessMenuData($userInfo['id']); |
|
|
$userInfo['menu'] = $this->getAccessMenuData($userInfo['id']); |
|
|
@ -221,15 +225,13 @@ class Login extends Base { |
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected function captchaCheck($username, $captchaToken, $captchaInput) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function setFailKey($username) |
|
|
protected function setFailKey($username) |
|
|
{ |
|
|
{ |
|
|
$failKey = "login:fail:{$username}"; |
|
|
$failKey = "login:fail:{$username}"; |
|
|
$failCount = (int) Cache::get($failKey, 0); |
|
|
$failCount = (int) Cache::get($failKey, 0); |
|
|
Cache::set($failKey, $failCount + 1, $this->lockMinutes * 60); |
|
|
$failCount += 1; |
|
|
|
|
|
Cache::set($failKey, $failCount, $this->lockMinutes * 60); |
|
|
|
|
|
return $failCount; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|