Created
December 2, 2009 18:22
-
-
Save aguimaraes/247414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') OR die('No direct access allowed.'); | |
class Auth_User_Model extends ORM { | |
/** | |
* Validates and optionally saves a new user record from an array. | |
* | |
* @param array values to check | |
* @param boolean save the record when validation succeeds | |
* @return boolean | |
*/ | |
public function validate(array & $array, $save = FALSE) | |
{ | |
$array = Validation::factory($array) | |
->pre_filter('trim') | |
->add_rules('email', 'required', 'length[4,127]', 'valid::email', array($this, 'email_available')) | |
->add_rules('username', 'required', 'length[4,32]', 'chars[a-zA-Z0-9_.]', array($this, 'username_available')) | |
->add_rules('password', 'required', 'length[5,42]') | |
->add_rules('password_confirm', 'matches[password]'); | |
return parent::validate($array, $save); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment