|
|
@ -89,13 +89,18 @@ class UserModel extends Model |
|
|
|
{ |
|
|
|
{ |
|
|
|
parent::__construct(); |
|
|
|
parent::__construct(); |
|
|
|
|
|
|
|
|
|
|
|
$this->config = (object) array_merge((array) new AauthConfig(), (array) $config); |
|
|
|
if (is_null($config)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$config = new \Config\Aauth(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->config = $config; |
|
|
|
$this->table = $this->config->dbTableUsers; |
|
|
|
$this->table = $this->config->dbTableUsers; |
|
|
|
$this->DBGroup = $this->config->dbProfile; |
|
|
|
$this->DBGroup = $this->config->dbProfile; |
|
|
|
|
|
|
|
|
|
|
|
$this->validationRules['email'] = 'required|if_exist|valid_email|is_unique[' . $this->table . '.email,id,{id}]'; |
|
|
|
$this->validationRules['email'] = 'required|if_exist|valid_email|is_unique[' . $this->table . '.email,id,{$id}]'; |
|
|
|
$this->validationRules['password'] = 'required|if_exist|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']'; |
|
|
|
$this->validationRules['password'] = 'required|if_exist|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']'; |
|
|
|
$this->validationRules['username'] = 'if_exist|is_unique[' . $this->table . '.username,id,{id}]|min_length[3]|regex_match[/' . $this->config->userRegexPattern . '/]'; |
|
|
|
$this->validationRules['username'] = 'if_exist|is_unique[' . $this->table . '.username,id,{$id}]|min_length[3]|regex_match[/' . $this->config->userRegexPattern . '/]'; |
|
|
|
|
|
|
|
|
|
|
|
$this->validationMessages = [ |
|
|
|
$this->validationMessages = [ |
|
|
|
'email' => [ |
|
|
|
'email' => [ |
|
|
@ -117,7 +122,7 @@ class UserModel extends Model |
|
|
|
|
|
|
|
|
|
|
|
if ($this->config->loginUseUsername) |
|
|
|
if ($this->config->loginUseUsername) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->validationRules['username'] = 'required|if_exist|is_unique[' . $this->table . '.username,id,{id}]|min_length[3]|regex_match[/' . $this->config->userRegexPattern . '/]'; |
|
|
|
$this->validationRules['username'] = 'required|if_exist|is_unique[' . $this->table . '.username,id,{$id}]|min_length[3]|regex_match[/' . $this->config->userRegexPattern . '/]'; |
|
|
|
|
|
|
|
|
|
|
|
$this->validationMessages['username']['required'] = lang('Aauth.requiredUsername'); |
|
|
|
$this->validationMessages['username']['required'] = lang('Aauth.requiredUsername'); |
|
|
|
} |
|
|
|
} |
|
|
|