Skip to content

Commit

Permalink
Merge pull request cydrobolt#384 from tdtgit/delete-link-confirm
Browse files Browse the repository at this point in the history
Users should be warned before they delete users or links
  • Loading branch information
overint authored Mar 29, 2018
2 parents 8c0d012 + 40e961e commit d39efe6
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions public/js/AdminCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {

// Delete user
$scope.deleteUser = function($event, user_id) {
var el = $($event.target);

apiCall('admin/delete_user', {
'user_id': user_id,
}, function(new_status) {
toastr.success('User successfully deleted.', 'Success');
$scope.reloadUserTables();
});
if(confirm("Are you sure to delete this user?")){
var el = $($event.target);

apiCall('admin/delete_user', {
'user_id': user_id,
}, function(new_status) {
toastr.success('User successfully deleted.', 'Success');
$scope.reloadUserTables();
});
}
};

$scope.changeUserRole = function(role, user_id) {
Expand Down Expand Up @@ -305,14 +307,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {

// Delete link
$scope.deleteLink = function($event, link_ending) {
var el = $($event.target);

apiCall('admin/delete_link', {
'link_ending': link_ending,
}, function(new_status) {
toastr.success('Link successfully deleted.', 'Success');
$scope.reloadLinkTables();
});
if(confirm("Are you sure to delete this link?")){
var el = $($event.target);

apiCall('admin/delete_link', {
'link_ending': link_ending,
}, function(new_status) {
toastr.success('Link successfully deleted.', 'Success');
$scope.reloadLinkTables();
});
}
};

// Disable and enable links
Expand Down

0 comments on commit d39efe6

Please sign in to comment.