Skip to content

Commit

Permalink
Merge pull request benedmunds#1585 from manusfreedom/manusfreedom-php…
Browse files Browse the repository at this point in the history
…-8.2

Fix PHP 8.2 dynamic properties errors
  • Loading branch information
benedmunds authored Mar 27, 2024
2 parents 6a5840a + 36b54e5 commit 2df5208
Showing 1 changed file with 52 additions and 17 deletions.
69 changes: 52 additions & 17 deletions models/Ion_auth_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,36 @@ class Ion_auth_model extends CI_Model
*/
public $tables = [];

/**
* Holds an array of joins used
*
* @var array
*/
public $join = [];

/**
* 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 All @@ -85,6 +92,34 @@ class Ion_auth_model extends CI_Model
*/
public $identity;

/**
* Identity column
*
* @var string
*/
public $identity_column;

/**
* Message start delimiter
*
* @var string
*/
public $message_start_delimiter ;

/**
* Message end delimiter
*
* @var string
*/
public $message_end_delimiter ;

/**
* Hash method
*
* @var string
*/
public $hash_method;

/**
* Where
*
Expand Down Expand Up @@ -205,7 +240,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 +250,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 +413,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 +425,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 +447,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 +996,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 @@ -2624,7 +2659,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

0 comments on commit 2df5208

Please sign in to comment.