From c03e00035fa0562f49b0548c12233d0378f1a457 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 28 Apr 2015 07:14:35 -0400 Subject: [PATCH] prevent archiving of the user's own account because they'll lose access to the control panel --- management/templates/users.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/management/templates/users.html b/management/templates/users.html index 15ca823b..8f0c87ef 100644 --- a/management/templates/users.html +++ b/management/templates/users.html @@ -188,6 +188,13 @@ function users_set_password(elem) { function users_remove(elem) { var email = $(elem).parents('tr').attr('data-email'); + + // can't remove yourself + if (api_credentials != null && email == api_credentials[0]) { + show_modal_error("Archive User", "You cannot archive your own account."); + return; + } + show_modal_confirm( "Archive User", $("

Are you sure you want to archive " + email + "?

The user's mailboxes will not be deleted (you can do that later), but the user will no longer be able to log into any services on this machine.

"),