summaryrefslogtreecommitdiffstats
path: root/userprefs.cgi
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-07-27 06:13:26 +0200
committerByron Jones <glob@mozilla.com>2015-07-27 06:13:26 +0200
commit5b27f640afa7ff9a6804949ad16667d988f7f5d4 (patch)
tree4da5c3f69dc6b026b8d8805542b717485d84149e /userprefs.cgi
parent92f16f758434dd1ce92a1043ade9bf7f8438fa78 (diff)
downloadbugzilla-5b27f640afa7ff9a6804949ad16667d988f7f5d4.tar.gz
bugzilla-5b27f640afa7ff9a6804949ad16667d988f7f5d4.tar.xz
Bug 1171806 - add the ability for a user to disable/"remove" their own account
Diffstat (limited to 'userprefs.cgi')
-rwxr-xr-xuserprefs.cgi21
1 files changed, 20 insertions, 1 deletions
diff --git a/userprefs.cgi b/userprefs.cgi
index 1764bb2dd..52c5adba0 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -143,6 +143,24 @@ sub SaveAccount {
$dbh->bz_commit_transaction;
}
+sub DisableAccount {
+ my $user = Bugzilla->user;
+
+ my $new_login = 'u' . $user->id . '@disabled.tld';
+
+ Bugzilla->audit(sprintf('<%s> self-disabled %s (now %s)', remote_ip(), $user->login, $new_login));
+
+ $user->set_login($new_login);
+ $user->set_name('');
+ $user->set_disabledtext('Disabled by account owner.');
+ $user->set_disable_mail(1);
+ $user->set_password('*');
+ $user->update();
+
+ Bugzilla->logout();
+ print Bugzilla->cgi->redirect(correct_urlbase());
+ exit;
+}
sub DoSettings {
my $user = Bugzilla->user;
@@ -598,7 +616,7 @@ Bugzilla->login(LOGIN_REQUIRED);
my $save_changes = $cgi->param('dosave');
$vars->{'changes_saved'} = $save_changes;
-my $current_tab_name = $cgi->param('tab') || "settings";
+my $current_tab_name = $cgi->param('tab') || "account";
# The SWITCH below makes sure that this is valid
trick_taint($current_tab_name);
@@ -621,6 +639,7 @@ SWITCH: for ($current_tab_name) {
last SWITCH if $handled;
/^account$/ && do {
+ DisableAccount() if $cgi->param('account_disable');
SaveAccount() if $save_changes;
DoAccount();
last SWITCH;