Commit 385ed22a authored by Timothée Floure's avatar Timothée Floure

Add 'disable my account' button to the member page

parent 4c502f31
Pipeline #1662 failed with stages
in 10 seconds
......@@ -332,20 +332,31 @@ post '/member/:username/disable' => sub {
my $message;
if ($members->contains(params->{username})) {
$members->remove(params->{username});
$message .= 'You have been removed from the members';
# Important: remove from member group.
if ($members->contains($member->{username})) {
$members->remove($member->{username});
$message .= 'You have been removed from the member group.';
}
# TODO
# foreach my $project (keys %$unipoly_projects) {
# my $group = Unipoly::Group->new($project);
# if ($group->contains(params->{username})) {
# $group->remove(params->{username});
# $message .= 'You have been removed from: ' .
# $unipoly_projects->{$project};
# }
# }
# Remove from other known LDAP groups.
foreach my $group_name (keys %$unipoly_groups) {
my $group = Unipoly::Group->new($group_name);
if ($group && $group->contains($member->{username})) {
$group->remove($member->{username});
$message .= 'You have been removed from: ' . $group_name . '.';
}
}
# Remove from every mailing list.
foreach my $list (keys %$mailing_lists) {
if (Lists::is_subscribed($member->{mail}, $list) eq $Lists::TRUE) {
if (Lists::unsubscribe($member->{mail}, $list) eq $Lists::FALSE) {
$message .= 'You have been removed from: ' . $list;
} else {
$message .= 'Could not remove you from: ' . $list;
}
}
}
flash message => $message;
redirect '/member/' . params->{username};
......
......@@ -147,10 +147,8 @@
<hr />
<!-- Not tested yet...
<form method="POST" action="/member/<% member.username %>/disable">
<button class="btn btn-danger btn-sm btn-block" type="submit" onclick="return confirm('This will disable your account and remove you from mailing lists. Are you sure?');">
Disable my account, I want to leave Unipoly!
</button>
</form>
-->
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment