I think instead of commenting // return redirect()->intended($this->redirectPath());
Add protected property in AuthController
protected $redirectTo = 'your path goes here...';
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i am posting a login form with ajax
$.ajax({ type: "POST", url: "/auth/login", data: "email=beastar457@gmail.com&password=12345", success: function(msg){ window.location.replace("/In/strims"); }, error: function(XMLHttpRequest, textStatus, errorThrown) { window.location.replace("/"); } }); shakeModal() /* Simulate error message from the server */
} in my trait AuthenticatesAndRegistersUsers i changed to :
public function postLogin(Request $request) { $this->validate($request, [ 'email' => 'required|email', 'password' => 'required', ]);
$credentials = $request->only('email', 'password');
if ($this->auth->attempt($credentials, $request->has('remember')))
{
return 1;
// return redirect()->intended($this->redirectPath());
}
return 0;
}
ant the problem is that when it fails it redirect me back to /auth/login how can i avoid it?
Please or to participate in this conversation.