v8: Add confirm overlay when deleting user account (#5487)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
88c6bb9c21
commit
ca824b01d6
@@ -0,0 +1,13 @@
|
||||
<div>
|
||||
|
||||
<div ng-if="model.confirmMessage"
|
||||
class="umb-alert mb2"
|
||||
ng-class="{ 'umb-alert--warning': model.confirmMessageStyle === 'warning',
|
||||
'umb-alert--danger': model.confirmMessageStyle === 'danger',
|
||||
'umb-alert--info': model.confirmMessageStyle === 'info'}">
|
||||
{{model.confirmMessage}}
|
||||
</div>
|
||||
|
||||
<p>{{model.content}}</p>
|
||||
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function UserEditController($scope, eventsService, $q, $timeout, $location, $routeParams, formHelper, usersResource, userService, contentEditingHelper, localizationService, notificationsService, mediaHelper, Upload, umbRequestHelper, usersHelper, authResource, dateHelper, editorService) {
|
||||
function UserEditController($scope, eventsService, $q, $location, $routeParams, formHelper, usersResource, userService, contentEditingHelper, localizationService, mediaHelper, Upload, umbRequestHelper, usersHelper, authResource, dateHelper, editorService, overlayService) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@@ -372,11 +372,32 @@
|
||||
vm.deleteNotLoggedInUserButtonState = "busy";
|
||||
|
||||
var confirmationMessage = vm.labels.deleteUserConfirmation;
|
||||
if (!confirm(confirmationMessage)) {
|
||||
vm.deleteNotLoggedInUserButtonState = "danger";
|
||||
return;
|
||||
}
|
||||
|
||||
localizationService.localizeMany(["general_delete", "general_cancel", "contentTypeEditor_yesDelete"])
|
||||
.then(function (data) {
|
||||
|
||||
const overlay = {
|
||||
view: "confirm",
|
||||
title: data[0],
|
||||
content: confirmationMessage,
|
||||
closeButtonLabel: data[1],
|
||||
submitButtonLabel: data[2],
|
||||
submitButtonStyle: "danger",
|
||||
close: function () {
|
||||
vm.deleteNotLoggedInUserButtonState = "danger";
|
||||
overlayService.close();
|
||||
},
|
||||
submit: function () {
|
||||
performDelete();
|
||||
overlayService.close();
|
||||
}
|
||||
};
|
||||
overlayService.open(overlay);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function performDelete() {
|
||||
usersResource.deleteNonLoggedInUser(vm.user.id).then(function (data) {
|
||||
formHelper.showNotifications(data);
|
||||
goToPage(vm.breadcrumbs[0]);
|
||||
|
||||
Reference in New Issue
Block a user