Permalink
Browse files

* Closes #2358 - Users' roles can now be changed without requiring a …

…password
  • Loading branch information...
1 parent a08d7b1 commit 90e461d42e801fc02e927ce1dce2a050d7d05ded @ekala ekala committed Oct 27, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 application/models/user.php
@@ -78,16 +78,17 @@ public static function custom_validate(array & $post, Auth $auth = null)
}
// Only check for the password if the user id has been specified
- if ( ! empty($post->user_id))
+ if (empty($post->user_id))
{
$post->add_rules('password','required', 'length[5,50]','alpha_numeric');
}
// If Password field is not blank
- if ( ! empty($post->password))
- {
- $post->add_rules('password','required','length[5,50]', 'alpha_numeric', 'matches[password_again]');
- }
+ if ( ! empty($post->password) OR (empty($post->password) AND ! empty($post->password_again)))
+ {
+ $post->add_rules('password','required','length[5,50]', 'alpha_numeric', 'matches[password_again]');
+ }
+
$post->add_rules('role','required','length[3,30]', 'alpha_numeric');
$post->add_rules('notify','between[0,1]');

0 comments on commit 90e461d

Please sign in to comment.