Skip to content

Commit

Permalink
Fix the valid_admin code -- it was considering all non-admins invalid.
Browse files Browse the repository at this point in the history
Fixes ticket #997 (highest prime under 1000!)
  • Loading branch information
bharat committed Jan 31, 2010
1 parent dccb2b7 commit 69897b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/user/models/user.php
Expand Up @@ -148,7 +148,8 @@ public function valid_password(Validation $v, $field) {
* Validate the admin bit.
*/
public function valid_admin(Validation $v, $field) {
if ($this->id == identity::active_user()->id && !$this->admin) {
$active = identity::active_user();
if ($this->id == $active->id && $active->admin && !$this->admin) {
$v->add_error("admin", "locked");
}
}
Expand Down

0 comments on commit 69897b4

Please sign in to comment.