Skip to content

Commit d613e8a

Browse files
committed
fix: Add frontend code for password confirmation
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent c9075d3 commit d613e8a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

apps/files_external/js/settings.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,25 @@ StorageConfig.prototype = {
267267
* @param {Function} [options.error] error callback
268268
*/
269269
save: function(options) {
270-
var self = this;
271270
var url = OC.generateUrl(this._url);
272271
var method = 'POST';
273272
if (_.isNumber(this.id)) {
274273
method = 'PUT';
275274
url = OC.generateUrl(this._url + '/{id}', {id: this.id});
276275
}
277276

277+
window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._save(method, url, options), options.error);
278+
},
279+
280+
/**
281+
* Private implementation of the save function (called after potential password confirmation)
282+
* @param {string} method
283+
* @param {string} url
284+
* @param {{success: Function, error: Function}} options
285+
*/
286+
_save: function(method, url, options) {
287+
self = this;
288+
278289
$.ajax({
279290
type: method,
280291
url: url,
@@ -348,6 +359,15 @@ StorageConfig.prototype = {
348359
}
349360
return;
350361
}
362+
363+
window.OC.PasswordConfirmation.requirePasswordConfirmation(() => this._destroy(options), options.error)
364+
},
365+
366+
/**
367+
* Private implementation of the DELETE method called after password confirmation
368+
* @param {{ success: Function, error: Function }} options
369+
*/
370+
_destroy: function(options) {
351371
$.ajax({
352372
type: 'DELETE',
353373
url: OC.generateUrl(this._url + '/{id}', {id: this.id}),

0 commit comments

Comments
 (0)