🐛 swu: Fix multiple credentials saving
We make sure to check if any of the credentials we support are contained in the incoming settings data and if so set that, and only that, on our plugin settings, instead of overwriting the stored credentials with just those that changed. See #4540
This commit is contained in:
1 parent
306e513ee3
commit
18b0565ea6
1 file changed
+12
-1
@@ -773,7 +773,9 @@ class SoftwareUpdatePlugin(
|
||||
def on_settings_save(self, data):
|
||||
# ~~ plugin settings
|
||||
|
||||
for key in self.get_settings_defaults():
|
||||
defaults = self.get_settings_defaults()
|
||||
|
||||
for key in defaults:
|
||||
if key in (
|
||||
"checks",
|
||||
"cache_ttl",
|
||||
@@ -783,6 +785,7 @@ class SoftwareUpdatePlugin(
|
||||
"octoprint_checkout_folder",
|
||||
"octoprint_type",
|
||||
"octoprint_release_channel",
|
||||
"credentials",
|
||||
):
|
||||
continue
|
||||
if key in data:
|
||||
@@ -912,6 +915,14 @@ class SoftwareUpdatePlugin(
|
||||
if update_pip_check_config:
|
||||
self._invalidate_version_cache("pip")
|
||||
|
||||
# ~~ credentials
|
||||
|
||||
if "credentials" in data:
|
||||
credentials = data["credentials"]
|
||||
for key in defaults["credentials"]:
|
||||
if key in credentials:
|
||||
self._settings.set(["credentials", key], credentials[key])
|
||||
|
||||
def get_settings_version(self):
|
||||
return 9
|
||||
|
||||
|
||||
Reference in new issue
Block a user