I am using Laravel 5.3, I have a situation here...I'm on PAGE-2 and logged-out from there then redirected to Login Page. Now, what I am trying to achieve is to redirect back to PAGE-2 if the user logs-in again.
the Current situation is that, the user will be redirected to defaultAfterLogin page, which is not my desired login flow.
NOTE: Default page after-login is "DashBoard".
It is OKAY IF YOU WILL GO THE FIRST-TIME TO PAGE-2(not the default DashBoard page) and if you're not LOGGED-IN you will be redirected to LOGIN PAGE then IF YOU'll login again you will be redirected back to PAGE-2, which is fine.
BUT what is happening now is that, when you're in PAGE-2 then you LOGOUT then you will be REDIRECTED TO LOGIN-PAGE, if you LOGIN again you will be redirected to "DashBoard" which is not what I want. It should redirect back to PAGE-2
The flow should be,... users will be redirected after login no matter which PAGE they're previously working with.
Here's the a sample script I am using (it's actually from laravel i'am using its built-in Auth)
protected function handleUserWasAuthenticated(Request $request, $throttles)
{
if ($throttles) {
$this->clearLoginAttempts($request);
}
if (method_exists($this, 'authenticated')) {
return $this->authenticated($request, Auth::guard($this->getGuard())->user());
}
return redirect()->intended($this->redirectPath());
}
Any ideas, please? Thank you very Much for your help.