Last active
June 18, 2018 16:19
-
-
Save dai199/4661224 to your computer and use it in GitHub Desktop.
CakePHP2 パスワードを2回入力させて同じものであればtrueを、違うものであればfalseを返す
This file contains hidden or 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 | |
| class User extends AppModel { | |
| public $validate = array( | |
| 'password' => array( | |
| 'rule' => array('between', 3, 10), | |
| 'message' => 'Between 3 to 10 characters' | |
| ), | |
| 'password_confirm' => array( | |
| 'rule' => array('passwordCheck'), | |
| 'message' => 'Confirm password again' | |
| ) | |
| ); | |
| public function passwordCheck(){ | |
| if($this->data[$this->alias]['password'] === $this->data[$this->alias]['password_confirm']){ | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment