Auth: Also reload theme mode if no theme is active

refs #4390
This commit is contained in:
Johannes Meyer 2021-06-24 09:42:38 +02:00
parent da56ddc312
commit 82485236f7
1 changed files with 7 additions and 2 deletions

View File

@ -104,14 +104,19 @@ class Auth
// Reload CSS if the theme changed
$themingConfig = Icinga::app()->getConfig()->getSection('themes');
$userTheme = $user->getPreferences()->getValue('icingaweb', 'theme');
$themeMode = $user->getPreferences()->getValue('icingaweb', 'theme_mode');
if (! (bool) $themingConfig->get('disabled', false) && $userTheme !== null) {
$defaultTheme = $themingConfig->get('default', StyleSheet::DEFAULT_THEME);
if (($userTheme !== $defaultTheme) || ($themeMode !== StyleSheet::DEFAULT_MODE)) {
if ($userTheme !== $defaultTheme) {
$this->getResponse()->setReloadCss(true);
}
}
// Also reload CSS if the theme mode changed
$themeMode = $user->getPreferences()->getValue('icingaweb', 'theme_mode');
if ($themeMode && $themeMode !== StyleSheet::DEFAULT_MODE) {
$this->getResponse()->setReloadCss(true);
}
// Reload entire layout if the locale changed
if (($locale = $user->getPreferences()->getValue('icingaweb', 'language')) !== null) {
if (setlocale(LC_ALL, 0) !== $locale && $this->getRequest()->isXmlHttpRequest()) {