From f5dda06c55c29f517d015336c0cc154bc7317aef Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 23 Feb 2021 14:53:55 -0800 Subject: [PATCH] Develop to master (#9195) * Added saml custom setting retrieveParametersFromServer to enable fixing SLO issues with Azure AD (#9187) * [FIX] Lite test email won't use the mail component (#9092) * [FIX] Lite test email won't use the mail component * Revert "[FIX] Lite test email won't use the mail component" This reverts commit 6dab9aa1a8cd4addfc7af65f2f7a2f1a0d6d2531. * Fix check for snipeSettings * Remove random text from message template * Revert "Fix check for snipeSettings" This reverts commit 887dcc7bbc4df199da545950bdee661e4d662a13. * Fix test notification with setupCompleted Co-authored-by: johnson-yi <63399474+johnson-yi@users.noreply.github.com> Co-authored-by: Oliver Walerys --- app/Http/Controllers/Auth/SamlController.php | 3 ++- app/Services/Saml.php | 14 ++++++++++++++ resources/views/notifications/Test.blade.php | 4 ++++ .../views/vendor/mail/markdown/message.blade.php | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Auth/SamlController.php b/app/Http/Controllers/Auth/SamlController.php index 48c8d05ab8..5a2075daed 100644 --- a/app/Http/Controllers/Auth/SamlController.php +++ b/app/Http/Controllers/Auth/SamlController.php @@ -128,7 +128,8 @@ class SamlController extends Controller public function sls(Request $request) { $auth = $this->saml->getAuth(); - $sloUrl = $auth->processSLO(true, null, null, null, true); + $retrieveParametersFromServer = $this->saml->getSetting('retrieveParametersFromServer', false); + $sloUrl = $auth->processSLO(true, null, $retrieveParametersFromServer, null, true); $errors = $auth->getErrors(); if (!empty($errors)) { diff --git a/app/Services/Saml.php b/app/Services/Saml.php index bb6c24cffb..fa2eb13105 100644 --- a/app/Services/Saml.php +++ b/app/Services/Saml.php @@ -324,6 +324,20 @@ class Saml return $this->_auth; } + /** + * Get a setting. + * + * @author Johnson Yi + * + * @param string|array|int $key + * @param mixed $default + * + * @return void + */ + public function getSetting($key, $default = null) { + return data_get($this->_settings, $key, $default); + } + /** * Gets the SP metadata. The XML representation. * diff --git a/resources/views/notifications/Test.blade.php b/resources/views/notifications/Test.blade.php index e4e479846f..0f58a54926 100644 --- a/resources/views/notifications/Test.blade.php +++ b/resources/views/notifications/Test.blade.php @@ -1,7 +1,11 @@ +@if ($setupCompleted = \App\Models\Setting::setupCompleted()) @component('mail::message') +@endif {{ trans('mail.test_mail_text') }} Thanks, Snipe-IT +@if ($setupCompleted) @endcomponent +@endif diff --git a/resources/views/vendor/mail/markdown/message.blade.php b/resources/views/vendor/mail/markdown/message.blade.php index 862611099e..0fcfba938c 100644 --- a/resources/views/vendor/mail/markdown/message.blade.php +++ b/resources/views/vendor/mail/markdown/message.blade.php @@ -45,7 +45,7 @@ Snipe-IT @endif @if ($snipeSettings->privacy_policy_link!='') -{{ trans('admin/settings/general.privacy_policy') }}ldfkgjg +{{ trans('admin/settings/general.privacy_policy') }} @endif @endcomponent