Skip to content

Commit 7c166b5

Browse files
committed
fix: Add validation to prevent deletion of the last admin user
1 parent b0d0c87 commit 7c166b5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

frontend/src/app/admin/user/user-update/user-management-update.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ export class UserMgmtUpdateComponent implements OnInit {
7575

7676
private onSaveError(error, type) {
7777
this.isSaving = false;
78-
this.utmToast.showError('Problem', 'The login or email is already in use, please check');
78+
79+
if (error.status === 400) {
80+
this.utmToast.showError('Error', 'Admin role removal is prohibited for the last remaining administrator user.');
81+
} else {
82+
this.utmToast.showError('Problem', 'The login or email is already in use, please check');
83+
}
7984
}
8085
}

0 commit comments

Comments
 (0)