Browse Source

updated UserModel

v3-dev
REJack 6 years ago
parent
commit
a12c8f804f
No known key found for this signature in database
GPG Key ID: 4A44B48700429F46
  1. 20
      application/Models/Aauth/UserModel.php

20
application/Models/Aauth/UserModel.php

@ -98,8 +98,8 @@ class UserModel extends Model
$this->table = $this->config->dbTableUsers;
$this->DBGroup = $this->config->dbProfile;
$this->validationRules['email'] = 'required_with[password]|valid_email|is_unique[' . $this->table . '.email,id,{id}]';
$this->validationRules['password'] = 'required_with[email]|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']';
$this->validationRules['email'] = 'required|valid_email|is_unique[' . $this->table . '.email,id,{id}]';
$this->validationRules['password'] = 'required|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']';
$this->validationRules['username'] = 'if_exist|is_unique[' . $this->table . '.username,id,{id}]|regex_match[/' . $this->config->userRegexPattern . '/]';
$this->validationMessages = [
@ -122,14 +122,24 @@ class UserModel extends Model
if ($this->config->loginUseUsername)
{
$this->validationRules['email'] = 'required_with[username,password]|valid_email|is_unique[' . $this->table . '.email,id,{id}]';
$this->validationRules['password'] = 'required_with[email,username]|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']';
$this->validationRules['username'] = 'required_with[email,password]|is_unique[' . $this->table . '.username,id,{id}]|regex_match[/' . $this->config->userRegexPattern . '/]';
$this->validationRules['username'] = 'required|is_unique[' . $this->table . '.username,id,{id}]|regex_match[/' . $this->config->userRegexPattern . '/]';
$this->validationMessages['username']['required'] = lang('Aauth.requiredUsername');
}
}
/**
* Update
*
*/
public function update($id = null, $data = null)
{
$this->validationRules['email'] = 'if_exist|valid_email|is_unique[' . $this->table . '.email,id,{id}]';
$this->validationRules['password'] = 'if_exist|min_length[' . $this->config->passwordMin . ']|max_length[' . $this->config->passwordMax . ']';
$this->validationRules['username'] = 'if_exist|is_unique[' . $this->table . '.username,id,{id}]|regex_match[/' . $this->config->userRegexPattern . '/]';
parent::update($id, $data);
}
/**
* Update last login by User ID
*

Loading…
Cancel
Save