samedi 26 novembre 2016

Laravel Ajax Login Tries To Redirect

I am trying to remove default Laravel behavior of redirected authenticated user once authenticated.

I commented in LoginController.php

//protected $redirectTo = '/home'; 

And also changed the AuthenticatesUsers vendor file to return JSON instead of a redirect on login success:

protected function sendLoginResponse(Request $request)
    {
        $request->session()->regenerate();

        $this->clearLoginAttempts($request);

        /*return $this->authenticated($request, $this->guard()->user())
                ?: redirect()->intended($this->redirectPath());*/

                 return response()->json(['SUCCESS' => 'AUTHENTICATED'], 200);
    }

But still when I successfully login I see in my Chrome network tab that I get an error, because it is trying to redirect me to /home which is an undefined route, leading to the error and halting my Laravel SPA.

Why is Laravel continuing to direct me to /home even after I comment it out and change the Vendor files?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2grYrHU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire