diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-14 15:12:16 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-16 16:49:18 +0200 |
commit | 3e387d427e9cfe42eed22f5cf2746bdae8d3d98f (patch) | |
tree | 2f550710dd9f012c6a55976600376ee8ca16fe70 | |
parent | b86dc076b554569d6b6bfc8c69509c0bae9685f1 (diff) | |
download | nextcloud-server-3e387d427e9cfe42eed22f5cf2746bdae8d3d98f.tar.gz nextcloud-server-3e387d427e9cfe42eed22f5cf2746bdae8d3d98f.zip |
fix: Add frontend code for password confirmationfix/788/add-password-confirmation-required-to-user-storage-create
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/files_external/js/settings.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 582276cad09..5cbd011bcc1 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -267,7 +267,6 @@ StorageConfig.prototype = { * @param {Function} [options.error] error callback */ save: function(options) { - var self = this; var url = OC.generateUrl(this._url); var method = 'POST'; if (_.isNumber(this.id)) { @@ -275,6 +274,18 @@ StorageConfig.prototype = { url = OC.generateUrl(this._url + '/{id}', {id: this.id}); } + window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._save(method, url, options), options.error); + }, + + /** + * Private implementation of the save function (called after potential password confirmation) + * @param {string} method + * @param {string} url + * @param {{success: Function, error: Function}} options + */ + _save: function(method, url, options) { + self = this; + $.ajax({ type: method, url: url, @@ -348,6 +359,15 @@ StorageConfig.prototype = { } return; } + + window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._destroy(options), options.error) + }, + + /** + * Private implementation of the DELETE method called after password confirmation + * @param {{ success: Function, error: Function }} options + */ + _destroy: function(options) { $.ajax({ type: 'DELETE', url: OC.generateUrl(this._url + '/{id}', {id: this.id}), |