By the way I'm using md5 in controller for register function, could that be that reason that hinders the validation?
On Dec 22, 12:42 am, John Maxim <[email protected]> wrote: > function confirmPassword() { > return (($this->data[$this->alias]['password']) == > Security::hash($this->data[$this->alias]['confirm_password'], > null, > true)); > > } > > Code 1 > -------------------------------------------- > function confirmPassword() { > $hash = Security::hash($this->data[$this->alias] > ['confirm_password'], null, true); > > if($this->data[$this->alias]['password'] == $hash) { > return true; > } > > return false; > > } > Code 2 > ----------------------------------------------------- > > Hi, > The custom function to check password if matched is always triggered > which means it is always not the same, I tried entering the same value > for both fields every time but it is triggered. > > The full code is below: > _____________________ > class User extends AppModel > { > var $name = 'User'; > > var $validate = array ( > > 'username' => array( > 'notEmpty' => array( > 'rule' => 'notEmpty', > 'message' => 'This field cannot be blank.', > 'last' => true, > ), > 'uniqueCheck' => array( > 'rule' => 'isUnique', > 'message' => 'That username has already been > taken.', > 'last' => true, > ), > 'lengthCheck' => array( > 'rule' => '/^.{6,40}$/', > 'message' => 'Minimum username 6 characters.', > 'last' => true, > ), > ), > > 'email' => array( > 'notEmpty' => array( > 'rule' => 'notEmpty', > 'message' => 'This field cannot be blank.', > 'last' => true, > ), > 'email' => array( > 'rule' => 'email', > 'message' => 'That is not a valid email address.', > 'last' => true, > ), > ), > > 'confirm_password' => array( > 'notEmpty' => array( > 'rule' => 'notEmpty', > 'message' => 'This field cannot be blank.', > 'last' => true, > ), > 'lengthCheck' => array( > 'rule' => '/^.{6,40}$/', > 'message' => 'Minimum password 6 characters.', > 'last' => true, > ), > 'checkMatch' => array( > 'rule' => 'confirmPassword', > 'message' => 'Both passwords should match.', > 'last' => true, > ), > > ), > > ); > > function confirmPassword() { > $hash = Security::hash($this->data[$this->alias] > ['confirm_password'], null, true); > > if($this->data[$this->alias]['password'] == $hash) { > return true; > } > > return false; > } > > } > > _____________ > > Can anyone see how the function be triggered indefinitely for every > same passwords entered? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
