mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
fix: Add frontend code for password confirmation
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
b86dc076b5
commit
3e387d427e
1 changed files with 21 additions and 1 deletions
|
|
@ -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}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue