mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Avoid a redirect loop if we have a login error (#16366)
* Avoid a redirect loop if we have a toasts (login error) * 1st try to a new approach * Fix extra return --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -52,7 +52,7 @@ class LoginController extends Controller
|
||||
public function showLoginForm(Request $request)
|
||||
{
|
||||
// Check if we want to redirect users to the socialite provider directly
|
||||
if (! $request->has('redirect') && Config::get('auth.socialite.redirect') && array_key_first(Config::get('auth.socialite.configs', []))) {
|
||||
if (! $request->has('redirect') && ! $request->session()->has('block_auto_redirect') && Config::get('auth.socialite.redirect') && array_key_first(Config::get('auth.socialite.configs', []))) {
|
||||
return (new SocialiteController)->redirect($request, array_key_first(Config::get('auth.socialite.configs', [])));
|
||||
}
|
||||
|
||||
|
@@ -76,7 +76,7 @@ class SocialiteController extends Controller
|
||||
$error_description = $request->query('error_description');
|
||||
toast()->error($error . ': ' . $error_description);
|
||||
|
||||
return redirect()->route('login');
|
||||
return redirect()->route('login')->with('block_auto_redirect', true);
|
||||
}
|
||||
|
||||
$this->socialite_user = Socialite::driver($provider)->user();
|
||||
@@ -122,9 +122,9 @@ class SocialiteController extends Controller
|
||||
return redirect()->intended();
|
||||
} catch (AuthenticationException $e) {
|
||||
toast()->error($e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('login');
|
||||
return redirect()->route('login')->with('block_auto_redirect', true);
|
||||
}
|
||||
}
|
||||
|
||||
private function register(string $provider): void
|
||||
|
Reference in New Issue
Block a user