Auth: Only reload CSS upon login if the theme **really** changed

fixes #2233
This commit is contained in:
Johannes Meyer 2021-03-22 12:28:30 +01:00
parent 0aa4e25723
commit f4da973f68
1 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@ use Icinga\User;
use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore;
use Icinga\Web\Session;
use Icinga\Web\StyleSheet;
class Auth
{
@ -100,8 +101,15 @@ class Auth
{
$this->setupUser($user);
// TODO(el): Quick-fix for #10957. Only reload CSS if the theme changed.
$this->getResponse()->setReloadCss(true);
// Reload CSS if the theme changed
$themingConfig = Icinga::app()->getConfig()->getSection('themes');
$userTheme = $user->getPreferences()->getValue('icingaweb', 'theme');
if (! (bool) $themingConfig->get('disabled', false) && $userTheme !== null) {
$defaultTheme = $themingConfig->get('default', StyleSheet::DEFAULT_THEME);
if ($userTheme !== $defaultTheme) {
$this->getResponse()->setReloadCss(true);
}
}
$this->user = $user;
if ($persist) {