Add onbeforeusersettingsave

This commit is contained in:
Shawn Bruce committed 2021-01-12 19:41:32 -05:00
1 parent 3d4acbe332
commit c8dbd89411
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");
});
};
}