here
$response = $broker->reset($credentials, function ($user, $password) {
$this->resetPassword($user, $password);
});
where does $password come from?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In my ResetPasswordController I override the reset method to be able to handle multilangauges (but this is not the problem).
For documentation, it came from Illuminate/Foundation/Auth/ResetsPasswords.php link to github code
That's my code
public function reset(Request $request)
{
$this->validate($request, $this->rules(), $this->validationErrorMessages());
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
// returns an array
$credentials = $this->credentials($request);
// returns an Illuminate\Auth\Passwords\PasswordBroker
$broker = $this->broker();
$user = $broker->getUser($credentials);
// To DEBUJ
//$tokens = $broker->getRepository();
$response = $broker->reset($credentials, function ($user, $password) {
$this->resetPassword($user, $password);
});
$locale = $user->locale;
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $response == Password::PASSWORD_RESET
? $this->sendResetResponse($response, $locale)
: $this->sendResetFailedResponse($request, $response);
}
Then I override resetPassword. Please note that at this point the password is still clear (not encrypted, I mean). I override it to avoid autologin after password reset.
protected function resetPassword($user, $password)
{
$user->password = Hash::make($password);
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
}
Note: The whole process seems to work well; user password is updated into db, the remember token is regenerated, the reset_password table row is deleted and user is succesfully redirected to login page with a success alert box.
The problem: when the user now uses the new password the system reply user not found....
Please or to participate in this conversation.