Buttons to disable two-factor authentication now work again (and show proper warning confirmation)

This commit is contained in:
Jan Böhmer 2022-08-14 17:28:36 +02:00
parent 93d817db81
commit 4fa8eef1bf
3 changed files with 31 additions and 4 deletions

View file

@ -10,6 +10,33 @@ export default class extends Controller
this._confirmed = false;
}
click(event) {
//If a user has not already confirmed the deletion, just let turbo do its work
if(this._confirmed) {
this._confirmed = false;
return;
}
event.preventDefault();
const message = this.element.dataset.deleteMessage;
const title = this.element.dataset.deleteTitle;
const that = this;
const confirm = bootbox.confirm({
message: message, title: title, callback: function (result) {
//If the dialog was confirmed, then submit the form.
if (result) {
that._confirmed = true;
event.target.click();
} else {
that._confirmed = false;
}
}
});
}
submit(event) {
//If a user has not already confirmed the deletion, just let turbo do its work
if(this._confirmed) {