Add support for deleting user accounts

Users can now delete their own accounts by clicking a link in the
account edit form and confirming the deletion on a follow-up page.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-07-25 11:04:19 +02:00
parent f4ee1278e5
commit 7df8dc8bcb
5 changed files with 45 additions and 0 deletions

View file

@ -55,6 +55,22 @@ if (isset($_COOKIE["AURSID"])) {
}
}
} elseif ($action == "DeleteAccount") {
/* Details for account being deleted. */
$acctinfo = account_details(in_request('ID'), in_request('U'));
if (can_edit_account($acctinfo)) {
$UID = $acctinfo['ID'];
if (in_request('confirm_Delete') && check_token()) {
user_delete($UID);
header('Location: /');
} else {
$username = $acctinfo['Username'];
include("account_delete.php");
}
} else {
print __("You do not have permission to edit this account.");
}
} elseif ($action == "AccountInfo") {
# no editing, just looking up user info
#