PreferenceForm: Detect client changes based on current session

not based on the stored preferences. The session is more up2date.

refs #4417
This commit is contained in:
Johannes Meyer 2021-07-05 18:08:15 +02:00
parent ed6d5f4958
commit df49f0c241

View File

@ -93,12 +93,13 @@ class PreferenceForm extends Form
*/ */
public function onSuccess() public function onSuccess()
{ {
$this->preferences = new Preferences($this->store ? $this->store->load() : array()); $currentPreferences = $this->Auth()->getUser()->getPreferences();
$oldTheme = $this->preferences->getValue('icingaweb', 'theme'); $oldTheme = $currentPreferences->getValue('icingaweb', 'theme');
$oldMode = $this->preferences->getValue('icingaweb', 'theme_mode'); $oldMode = $currentPreferences->getValue('icingaweb', 'theme_mode');
$oldLocale = $this->preferences->getValue('icingaweb', 'language'); $oldLocale = $currentPreferences->getValue('icingaweb', 'language');
$defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME); $defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME);
$this->preferences = new Preferences($this->store ? $this->store->load() : array());
$webPreferences = $this->preferences->get('icingaweb', array()); $webPreferences = $this->preferences->get('icingaweb', array());
foreach ($this->getValues() as $key => $value) { foreach ($this->getValues() as $key => $value) {
if ($value === '' if ($value === ''