vendredi 10 mai 2019

Password reset not returning error messages on validation

After reseting password, user gets e-mail with password reset link & token. By opening this link user is presented with Password Reset form (view).

Until this point all works great.. but whenever I pass wrong e-mail to trigger "email not valid" error warning, it gives me nothing.

enter image description here

Inspecting C:\Users\richa\Projects\globeguru\cms\vendor\laravel\framework\src\Illuminate\Foundation\Auth\ResetsPasswords.php I came across responsibe function on line 3:

php

public function reset(Request $request)
{
    $request->validate($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.
    $response = $this->broker()->reset(
        $this->credentials($request), function ($user, $password) {
            $this->resetPassword($user, $password);
        }
    );

    // 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($request, $response)
                : $this->sendResetFailedResponse($request, $response);
}

This line:

$request->validate($this->rules(), $this->validationErrorMessages());

Which brings me to this function:

protected function validationErrorMessages()
{
    return [];
}

My question is - how can I trigger the error message and return it via validationErrorMessages() function?



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Jv5m4D
via IFTTT

Aucun commentaire:

Enregistrer un commentaire