Back

AuthController auth/register invlid input


I have a fresh install of Laravel 5.1 and was working on getting auth/register working to work through the process of creating a new user.

I have created the view for user registration with an action of POST to /auth/register. The first thing to test is errors so I submitted the form with empty input fields and as expected this did not pass validation. In AuthController

protected function validator( array $data)

returns false as expected and the best that I been able to ascertain is in /vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php there is

public function postRegister(Request $request)
{
    $validator = $this->validator($request->all());
    if ($validator->fails()) {
        $this->throwValidationException(
            $request, $validator
        );
    }

    Auth::login($this->create($request->all()));

    return redirect($this->redirectPath());
}

I am pretty sure that the controller is throwing an exception.

Do I have to override postRegister or can I catch the exception that is being thrown by the current definition of postRegister and if I can catch that exception how do I go about catching the exception.

I want to be able to return the registration with errors for the fields with invalid input.


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us