This commit is contained in:
Will Browning
2023-11-16 10:46:16 +00:00
parent 6470253fb9
commit e5a1d64158
5 changed files with 240 additions and 218 deletions

View File

@@ -101,6 +101,28 @@ class LoginController extends Controller
return $request->only('id', 'password');
}
/**
* Send the response after the user was authenticated.
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendLoginResponse(Request $request)
{
$request->session()->regenerate();
$this->clearLoginAttempts($request);
if ($response = $this->authenticated($request, $this->guard()->user())) {
return $response;
}
// If the intended path is just the dashboard then ignore and use the user's login redirect instead
$redirectTo = $this->redirectTo();
$intended = session()->pull('url.intended');
return $intended === url('/') ? redirect()->to($redirectTo) : redirect()->intended($intended ?? $redirectTo);
}
/**
* Get the failed login response instance.
*