forked from fixin.me/fixin.me
Prevent sole admin from deleting their account
Without this guard, the last admin in the system could delete their own account, making the application unmanageable. This adds a model method `User#sole_admin?`, a controller guard in `RegistrationsController#destroy`, and disables the delete button in the profile edit view when the current user is the only remaining admin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,9 @@ en:
|
||||
New password:
|
||||
<br><em>leave blank to keep unchanged</em>
|
||||
%{password_length_hint_html}
|
||||
registrations:
|
||||
destroy:
|
||||
sole_admin: You cannot delete the only admin account.
|
||||
actions: Actions
|
||||
setup:
|
||||
new:
|
||||
|
||||
Reference in New Issue
Block a user