From 92fe1287eac5424b89fea07c2b99aee20fb9aba3 Mon Sep 17 00:00:00 2001 From: Johnson Yi Date: Fri, 29 Apr 2022 15:35:08 +0000 Subject: [PATCH 1/2] Do not saml login automatically after normal logout --- app/Http/Controllers/Auth/LoginController.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index d36a391036..2754d96d2d 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') { From 281c6df7b34845bdb6331796efdb17bac206baf1 Mon Sep 17 00:00:00 2001 From: Johnson Yi Date: Fri, 29 Apr 2022 15:35:40 +0000 Subject: [PATCH 2/2] Customize login page when REQUIRE_SAML is enabled --- resources/views/auth/login.blade.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 409b6ed59e..b0db617300 100755 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -36,6 +36,7 @@ @include('notifications') + @if (!config('app.require_saml'))
@@ -59,10 +60,10 @@
- + @endif - @if ($snipeSettings->saml_enabled) + @if (!config('app.require_saml') && $snipeSettings->saml_enabled)
{{ trans('auth/general.saml_login') }} @@ -71,12 +72,16 @@ @endif
@if ($snipeSettings->custom_forgot_pass_url) {{ trans('auth/general.forgot_password') }} - @else + @elseif (!config('app.require_saml')) {{ trans('auth/general.forgot_password') }} @endif