Wednesday, March 15, 2017

How to display validate error - reset password in Laravel 5.4

I try to catch error message from validate in .../app/Http/Controllers/Auth/ResetPasswordController.php:

public function reset(Request $request)
    {
        $this->validate($request, $this->rules(), $this->validationErrorMessages());

        $response = $this->broker()->reset(
                $this->credentials($request), function ($user, $password) {
            $this->resetPassword($user, $password);
        }
        );

        return $response == Password::PASSWORD_RESET
                ? $this->sendResetResponse($response)
                : $this->sendResetFailedResponse($request, $response);
    }

but if the validate failed in session there is no errors.

In:

public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
    {
        $validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes);
        if ($validator->fails()) {
            $this->throwValidationException($request, $validator);
        }
    }

throw exception but I do not know how to use it in session.



via Tomasz

Advertisement