Merge pull request #3944 from kantlivelong/add_onbeforeusersettingsave

Add onUserSettingsBeforeSave
This commit is contained in:
Gina Häußge authored and GitHub committed 2021-01-13 12:58:58 +01:00
commit 31f10576df
2 files changed
+9

No files matched your search

+4
View File
@@ -259,6 +259,10 @@ onUserSettingsShown()
onUserSettingsHidden()
Called when the user settings dialog is hidden.
onUserSettingsBeforeSave()
Called just before the user settings view model is sent to the server. This is useful, for example, if your plugin
needs to compute persisted settings from a custom view model.
onWizardDetails(response)
Called with the response from the wizard detail API call initiated before opening the wizard dialog. Will contain
the data from all :class:`~octoprint.plugin.WizardPlugin` implementations returned by their :meth:`~octoprint.plugin.WizardPlugin.get_wizard_details`
@@ -79,6 +79,8 @@ $(function () {
self.save = function () {
if (!CONFIG_ACCESS_CONTROL) return;
self.userSettingsDialog.trigger("beforeSave");
if (self.access_password() && !self.passwordMismatch()) {
self.users.updatePassword(
self.currentUser().name,
@@ -162,6 +164,9 @@ $(function () {
self.userSettingsDialog.on("hidden", function () {
callViewModels(allViewModels, "onUserSettingsHidden");
});
self.userSettingsDialog.on("beforeSave", function () {
callViewModels(allViewModels, "onUserSettingsBeforeSave");
});
};
}