Using Auth ORM, how can I tell if the old password is correct before changing the password. I have seen code for older versions of Kohana which uses the find_salt method, but this no longer applicable in version 3.3.
Any ideas?
Using Auth ORM, how can I tell if the old password is correct before changing the password. I have seen code for older versions of Kohana which uses the find_salt method, but this no longer applicable in version 3.3.
Any ideas?
On
Use the hash() method to hash the password string, after compare with the stored one.
$auth = Auth::instance();
$user = ORM::factory('user')
->where('username', '=', 'User')
->find();
if ($auth->hash($_POST['password']) == $user->password)
{
// Passwords match, change here.
}
else
{
// Passwords not match.
}
There is a better way to do this using Validation class: