/** * Rules for the user model. Because the password is _always_ a hash * when it's set,you need to run an additional not_empty rule in your controller * to make sure you didn't hash an empty string. The password rules * should be enforced outside the model or with a model helper method. * * @return array Rules * @see Model_Auth_User::rules */ public function rules() { $parent = parent::rules(); // fixes the min_length username value $parent['username'][1] = array('min_length', array(':value', 1)); return $parent; }
public function rules() { $rules = parent::rules(); $rules['password'] = array(); // empty rules for password $rules['username'][] = array('alpha_numeric'); // new rules $_rules = array('first_name' => array(array('not_empty'), array('max_length', array(":value", 254))), 'last_name' => array(array('not_empty'), array('max_length', array(":value", 254)))); return $rules + $_rules; }
/** * Rules for the user model. Because the password is _always_ a hash * when it's set,you need to run an additional not_empty rule in your controller * to make sure you didn't hash an empty string. The password rules * should be enforced outside the model or with a model helper method. * * @return array Rules * @see Model_Auth_User::rules */ public function rules() { $parent = parent::rules(); // fixes the min_length username value $parent['username'][1] = array('min_length', array(':value', 1)); $require_email = Kohana::$config->load('useradmin.require_email'); if ($require_email === false) { unset($parent['email']); } return $parent; }
public function rules() { parent::rules(); return array('username' => array(array('not_empty')), 'password' => array(array('not_empty')), 'email' => array(array('not_empty'))); }