Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't get $user twice; some code cleanup #1577

Open
wants to merge 1 commit into
base: 3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/Ion_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct()
$this->load->model('ion_auth_model');

$this->_cache_user_in_group =& $this->ion_auth_model->_cache_user_in_group;

$email_config = $this->config->item('email_config', 'ion_auth');

if ($this->config->item('use_ci_email', 'ion_auth') && isset($email_config) && is_array($email_config))
Expand Down
36 changes: 18 additions & 18 deletions models/Ion_auth_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@ class Ion_auth_model extends CI_Model

/**
* activation code
*
*
* Set by deactivate() function
* Also set on register() function, if email_activation
* Also set on register() function, if email_activation
* option is activated
*
* This is the value devs should give to the user
*
* This is the value devs should give to the user
* (in an email, usually)
*
*
* It contains the *user* version of the activation code
* It's a value of the form "selector.validator"
*
* It's a value of the form "selector.validator"
*
* This is not the same activation_code as the one in DB.
* The DB contains a *hashed* version of the validator
* and a selector in another column.
*
*
* THe selector is not private, and only used to lookup
* the validator.
*
*
* The validator is private, and to be only known by the user
* So in case of DB leak, nothing could be actually used.
*
*
* @var string
*/
public $activation_code;
Expand Down Expand Up @@ -205,7 +205,7 @@ public function __construct()

// initialize the database
$group_name = $this->config->item('database_group_name', 'ion_auth');
if (empty($group_name))
if (empty($group_name))
{
// By default, use CI's db that should be already loaded
$CI =& get_instance();
Expand All @@ -215,7 +215,7 @@ public function __construct()
{
// For specific group name, open a new specific connection
$this->db = $this->load->database($group_name, TRUE, TRUE);
}
}

// initialize db tables data
$this->tables = $this->config->item('tables', 'ion_auth');
Expand Down Expand Up @@ -378,7 +378,7 @@ public function rehash_password_if_needed($hash, $identity, $password)
/**
* Get a user by its activation code
*
* @param bool $user_code the activation code
* @param bool $user_code the activation code
* It's the *user* one, containing "selector.validator"
* the one you got in activation_code member
*
Expand All @@ -390,7 +390,7 @@ public function get_user_by_activation_code($user_code)
// Retrieve the token object from the code
$token = $this->_retrieve_selector_validator_couple($user_code);

if ($token)
if ($token)
{
// Retrieve the user according to this selector
$user = $this->where('activation_selector', $token->selector)->users()->row();
Expand All @@ -412,7 +412,7 @@ public function get_user_by_activation_code($user_code)
* Validates and removes activation code.
*
* @param int|string $id the user identifier
* @param bool $code the *user* activation code
* @param bool $code the *user* activation code
* if omitted, simply activate the user without check
*
* @return bool
Expand Down Expand Up @@ -961,7 +961,7 @@ public function login($identity, $password, $remember=FALSE)
$this->clear_remember_code($identity);
}
}

// Rehash if needed
$this->rehash_password_if_needed($user->password, $identity, $password);

Expand Down Expand Up @@ -1810,7 +1810,7 @@ public function update($id, array $data)
{
if( ! empty($data['password']))
{
$user = $this->user($id)->row();
// $user = $this->user($id)->row();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to remove one of these and then comment out the other?

$data['password'] = $this->hash_password($data['password'], $user->{$this->identity_column});
if ($data['password'] === FALSE)
{
Expand Down Expand Up @@ -2624,7 +2624,7 @@ protected function _get_hash_parameters($identity = NULL)
case 'argon2id':
$params = $this->config->item('argon2_default_params', 'ion_auth');
break;

default:
// Do nothing
}
Expand Down