users: move account deletion endpoint to /users/:id/deactivate.

Move the account deletion endpoint from /maintenance/users/deletion to either:

* https://danbooru.donmai.us/users/deactivate
* https://danbooru.donmai.us/users/:id/deactivate

This incidentally allows the Owner-level user to deactivate accounts belonging to other users. This
is meant for things like deactivating inactive accounts with invalid or abusive names. This is
limited to accounts below Gold level for security.
This commit is contained in:
evazion
2022-11-05 18:31:49 -05:00
parent 59872d2ed5
commit 3ffde5b23d
10 changed files with 163 additions and 112 deletions

View File

@@ -0,0 +1,47 @@
<% page_title "Deactivate Account" %>
<%= render "secondary_links" %>
<div id="c-users">
<div id="a-deactivate">
<% if @user == CurrentUser.user %>
<h1>Deactivate Account</h1>
<% else %>
<h1>Deactivate Account: <%= link_to_user @user %></h1>
<% end %>
<div class="prose mb-4">
<p>
You can deactivate your <%= Danbooru.config.app_name %> account by entering your password below. Deactivating
your account will do the following things:
</p>
<ul>
<li>Change your username to a generic username (<i>user_<%= @user.id %></i>).</li>
<li>Delete your password, email address, and account settings.</li>
<li>Delete your favorites.</li>
<li>Delete your saved searches.</li>
</ul>
<p>
The following things will <strong>not</strong> be deleted:
</p>
<ul>
<li>Posts you've uploaded.</li>
<li>Your comments, forum posts, and private messages.</li>
<li>Your tag edits, wiki edits, translation notes, and any other contributions you've made to the site.</li>
<li>Your login history, including your IP address and geographic location. This is kept for moderation purposes.</li>
</ul>
<p>
Enter your password below to deactivate your account. This cannot be
undone. Your account cannot be recovered after it is deactivated.
</p>
</div>
<%= edit_form_for(:user, url: user_path(@user), method: :delete) do |f| %>
<%= f.input :password %>
<%= f.submit "Deactivate account", "data-confirm": "Are you sure you want to deactivate your account? This cannot be undone" %>
<% end %>
</div>
</div>

View File

@@ -53,7 +53,7 @@
<div class="input">
<label>Account</label>
<p>
<%= link_to "Deactivate account", maintenance_user_deletion_path, id: "delete-account" %>
<%= link_to "Deactivate account", deactivate_user_path(@user), id: "delete-account" %>
(<em>requires confirmation</em>)
</p>
</div>