Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow users to delete their own accounts #8548

Merged
merged 4 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cgi/user.pl
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@

if ($type eq 'edit') {
if (single_param('delete') eq 'on') {
if ($admin) {
$type = 'delete';
}
else {
display_error_and_exit($Lang{error_no_permission}{$lang}, 403);
}
$type = 'delete';
}
}

Expand Down
10 changes: 9 additions & 1 deletion po/common/common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,15 @@ msgid "Delete the images"
msgstr ""

msgctxt "delete_user"
msgid "Delete an user"
msgid "Delete a user"
msgstr ""

msgctxt "delete_confirmation"
msgid "This will delete your user details and anonymise all of your contributions. Please re-enter your user name to confirm."
msgstr ""

msgctxt "danger_zone"
msgid "Danger Zone"
msgstr ""

msgctxt "diff_add"
Expand Down
8 changes: 8 additions & 0 deletions po/common/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ msgctxt "delete_user"
msgid "Delete an user"
msgstr "Delete an user"

msgctxt "delete_confirmation"
msgid "This will delete your user details and anonymise all of your contributions. Please re-enter your user name to confirm."
msgstr "This will delete your user details and anonymise all of your contributions. Please re-enter your user name to confirm."

msgctxt "danger_zone"
msgid "Danger Zone"
msgstr "Danger Zone"

msgctxt "diff_add"
msgid "Added:"
msgstr "Added:"
Expand Down
14 changes: 8 additions & 6 deletions templates/web/pages/user_form/user_form_page.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<!-- Start form -->

<form method="post" action="/cgi/user.pl" enctype="multipart/form-data">
<form method="post" action="/cgi/user.pl" enctype="multipart/form-data" id="user_form">
[% FOREACH section IN sections %]

[% IF section.name %]
Expand Down Expand Up @@ -127,12 +127,14 @@
<p>[% lang("unsubscribe_info") %]</p>
[% END %]

[% IF admin %]
<label>
<input type="checkbox" name="delete" onchange="if (this.checked) { if (!confirm('This action cannot be undone, are you sure you want to delete the user?')) { this.checked = false }}" />
[% lang("delete_user") %]
</label>
[% IF userid %]
<fieldset>
<legend class="text_warning">[% lang("danger_zone") %]</legend>
<input type="button" name=".delete" class="button text_warning" value="[% lang("delete_user") %]" onclick="if ('[% userid %]'.localeCompare(prompt('[% lang("delete_confirmation") %]'),undefined,'base') === 0) {document.getElementById('delete_input').value='on';document.getElementById('user_form').submit();}"/>
<input type="hidden" name="delete" id="delete_input"/>
</fieldset>
[% END %]

<input type="hidden" name="action" value="process" />
<input type="hidden" name="type" value="[% type %]" />
[% IF userid %]
Expand Down
Loading