|
@@ -169,42 +169,41 @@ class Auth extends \ba\Auth
|
|
|
public function login(string $username, string $password, bool $keep = false,&$force=0,&$userId='')//: bool
|
|
|
{
|
|
|
$this->model = Admin::where('username', $username)->find();
|
|
|
- var_dump($this->model);die;
|
|
|
if (!$this->model) {
|
|
|
$this->setError('Username is incorrect');
|
|
|
return false;
|
|
|
}
|
|
|
- if ($this->model->status == '0') {
|
|
|
+ if ($this->model->STATUS == '0') {
|
|
|
$this->setError('Account disabled');
|
|
|
return false;
|
|
|
}
|
|
|
$adminLoginRetry = Config::get('buildadmin.admin_login_retry');
|
|
|
- if ($adminLoginRetry && $this->model->login_failure >= $adminLoginRetry && time() - $this->model->getData('last_login_time') < 86400) {
|
|
|
+ if ($adminLoginRetry && $this->model->LOGIN_FAILURE >= $adminLoginRetry && time() - $this->model->getData('last_login_time') < 86400) {
|
|
|
$this->setError('Please try again after 1 day');
|
|
|
return false;
|
|
|
}
|
|
|
- if ($this->model->password != encrypt_password($password, $this->model->salt)) {
|
|
|
+ if ($this->model->PASSWORD != encrypt_password($password, $this->model->SALT)) {
|
|
|
$this->loginFailed();
|
|
|
$this->setError('Password is incorrect');
|
|
|
return false;
|
|
|
}
|
|
|
if (Config::get('buildadmin.admin_sso')) {
|
|
|
- Token::clear(self::TOKEN_TYPE, $this->model->id);
|
|
|
- Token::clear(self::TOKEN_TYPE . '-refresh', $this->model->id);
|
|
|
+ Token::clear(self::TOKEN_TYPE, $this->model->ID);
|
|
|
+ Token::clear(self::TOKEN_TYPE . '-refresh', $this->model->ID);
|
|
|
}
|
|
|
- $userId = $this->model->id;
|
|
|
+ $userId = $this->model->ID;
|
|
|
if($password == $username.'@Zskk2024')
|
|
|
{
|
|
|
$force = 3;
|
|
|
return true;
|
|
|
}
|
|
|
- if(empty($this->model->update_pass_time))
|
|
|
+ if(empty($this->model->UPDATE_PASS_TIME))
|
|
|
{
|
|
|
//初始密码未更换过
|
|
|
$force = 1;
|
|
|
return true;
|
|
|
}
|
|
|
- if((time()-(strtotime($this->model->update_pass_time))) > 90*86400)
|
|
|
+ if((time()-(strtotime($this->model->UPDATE_PASS_TIME))) > 90*86400)
|
|
|
{
|
|
|
//密码未更新的时间超过90天
|
|
|
$force = 2;
|