Password validation using ion auth in CodeIgniter Password validation using ion auth in CodeIgniter codeigniter codeigniter

Password validation using ion auth in CodeIgniter


Ion auth creator here.

The default encryption is sadly using SHA1 for backwards compatibility.

There is an option in the config to use BCrypt instead which is strongly recommended.

The password is hashed along with a salt though so simply running SHA1 against the password won't give you the same results. Take a look at the hash_password() method to see how it's done here: https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/models/ion_auth_model.php#L267

If you're using all the defaults you can do this to compare:

$user = $this->ion_auth->user();$old_password = $this->input->post('old_password');$password_matches = $this->ion_auth->hash_password_db($user->id, $old_password);