Skip to content

Commit

Permalink
Merge pull request opencart#13750 from mhcwebdesign/3.0.x.x
Browse files Browse the repository at this point in the history
[3.0.x.x] The administrator should not be able to disable himself
  • Loading branch information
mhcwebdesign committed Mar 1, 2024
2 parents f2626af + d5ccfff commit 580e711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions upload/admin/controller/user/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ protected function validateForm() {
}
}

$total_users = $this->model_user_user->getTotalUsers();

if ($total_users <= 1 && isset($this->request->post['status']) && $this->request->post['status'] == 0) {
$this->error['warning'] = $this->language->get('error_single_user');
}

return !$this->error;
}

Expand Down
3 changes: 2 additions & 1 deletion upload/admin/language/en-gb/user/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
$_['error_firstname'] = 'First Name must be between 1 and 32 characters!';
$_['error_lastname'] = 'Last Name must be between 1 and 32 characters!';
$_['error_email'] = 'E-Mail Address does not appear to be valid!';
$_['error_exists_email'] = 'Warning: E-Mail Address is already registered!';
$_['error_exists_email'] = 'Warning: E-Mail Address is already registered!';
$_['error_single_user'] = 'Warning: You can not disable your own account!';

0 comments on commit 580e711

Please sign in to comment.