In a project with frontend user login, I need the possibility for logged-in users to change their password. For security reasons, they should enter their current password and then the desired new password with repetition. Some years ago I implemented something like that with Kirby 2:
// get the old/existing password from form input $old_pw = get('oldPW'); // get the new password $new_pw = get('newPW'); // get the new password confirmation $new_pw_confirm = get('newPWconfirm'); // get old/existing password from site $hash = $site->user()->current()->data()['password']; // check if old password is correct and if new password fits if ((password::match($old_pw, $hash)) AND ($new_pw == $new_pw_confirm)) // do something...
In Kirby 3 I get the hash of the current password with
But how do I change the last query
(password::match) so that it works under Kirby 3?
auth->login() doesn’t seem to be the appropriate method.