Skip to content

Commit ce5a1c8

Browse files
committed
Disable deletion link for elevated users
1 parent 90f9339 commit ce5a1c8

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

app/views/devise/registrations/edit.html.erb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@
5959
<%= f.submit "Update", class: 'button is-filled is-very-large', disabled: sso %>
6060
<% end %><br/>
6161

62-
<%= link_to delete_account_path, class: 'button is-outlined is-danger' do %>
63-
Delete my account &raquo;
62+
<% if current_user.at_least_moderator? %>
63+
<%= link_to 'javascript:void(0)', class: 'button is-outlined is-danger', disabled: true do %>
64+
Delete my account &raquo;
65+
<% end %>
66+
<p class="has-color-red has-font-size-caption">
67+
Moderators and admins cannot be self-deleted. Contact support if you wish to delete your account.
68+
</p>
69+
<% else %>
70+
<%= link_to delete_account_path, class: 'button is-outlined is-danger' do %>
71+
Delete my account &raquo;
72+
<% end %>
6473
<% end %>

0 commit comments

Comments
 (0)