Guest User

Untitled

a guest
Apr 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2.  
  3. class Auth_User_Model extends ORM {
  4.  
  5. /**
  6. * Validates and optionally saves a new user record from an array.
  7. *
  8. * @param array values to check
  9. * @param boolean save the record when validation succeeds
  10. * @return boolean
  11. */
  12. public function validate(array & $array, $save = FALSE)
  13. {
  14. $array = Validation::factory($array)
  15. ->pre_filter('trim')
  16. ->add_rules('email', 'required', 'length[4,127]', 'valid::email', array($this, 'email_available'))
  17. ->add_rules('username', 'required', 'length[4,32]', 'chars[a-zA-Z0-9_.]', array($this, 'username_available'))
  18. ->add_rules('password', 'required', 'length[5,42]')
  19. ->add_rules('password_confirm', 'matches[password]');
  20.  
  21. return parent::validate($array, $save);
  22. }
Add Comment
Please, Sign In to add comment