diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-23 17:12:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-23 17:12:55 +0200 |
commit | c3d52f6681877cb78dfa15ea893f6ccdeaf09d92 (patch) | |
tree | 1579ad98f53c351f1200cfc3311d8c5ce35be24e | |
parent | 0fef593f7b443140869a5234f12364d3b8e5aaf9 (diff) | |
parent | d613e8a2e34751469c9d74ed0679fbb766e6015d (diff) | |
download | nextcloud-server-c3d52f6681877cb78dfa15ea893f6ccdeaf09d92.tar.gz nextcloud-server-c3d52f6681877cb78dfa15ea893f6ccdeaf09d92.zip |
Merge pull request #48748 from nextcloud/backport/48373/stable30
[stable30] fix: add PasswordConfirmationRequired to create user storages endpoint
-rw-r--r-- | apps/files_external/js/settings.js | 22 | ||||
-rw-r--r-- | apps/files_external/lib/Controller/UserStoragesController.php | 4 |
2 files changed, 25 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}), diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index a85aa3faa96..0ebfd6bcc4e 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -13,6 +13,7 @@ use OCA\Files_External\NotFoundException; use OCA\Files_External\Service\UserStoragesService; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; use OCP\AppFramework\Http\DataResponse; use OCP\IConfig; use OCP\IGroupManager; @@ -99,6 +100,7 @@ class UserStoragesController extends StoragesController { * @return DataResponse */ #[NoAdminRequired] + #[PasswordConfirmationRequired] public function create( $mountPoint, $backend, @@ -154,6 +156,7 @@ class UserStoragesController extends StoragesController { * @return DataResponse */ #[NoAdminRequired] + #[PasswordConfirmationRequired] public function update( $id, $mountPoint, @@ -205,6 +208,7 @@ class UserStoragesController extends StoragesController { * {@inheritdoc} */ #[NoAdminRequired] + #[PasswordConfirmationRequired] public function destroy($id) { return parent::destroy($id); } |