diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index d36a39103..2754d96d2 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -68,15 +68,17 @@ class LoginController extends Controller return redirect()->intended('/'); } - // If the environment is set to ALWAYS require SAML, go straight to the SAML route. - // We don't need to check other settings, as this should override those. - if (config('app.require_saml')) { - return redirect()->route('saml.login'); - } + if (!$request->session()->has('loggedout')) { + // If the environment is set to ALWAYS require SAML, go straight to the SAML route. + // We don't need to check other settings, as this should override those. + if (config('app.require_saml')) { + return redirect()->route('saml.login'); + } - if ($this->saml->isEnabled() && Setting::getSettings()->saml_forcelogin == '1' && ! ($request->has('nosaml') || $request->session()->has('error'))) { - return redirect()->route('saml.login'); + if ($this->saml->isEnabled() && Setting::getSettings()->saml_forcelogin == '1' && ! ($request->has('nosaml') || $request->session()->has('error'))) { + return redirect()->route('saml.login'); + } } if (Setting::getSettings()->login_common_disabled == '1') {