Last active
September 28, 2015 10:38
-
-
Save jamband/1426237 to your computer and use it in GitHub Desktop.
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 CActiveRecord | |
| { | |
| public $password2; | |
| ... | |
| public function rules() | |
| { | |
| return array( | |
| ... | |
| array('password', 'compare', 'compareAttribute'=>'password2', 'message'=>'{attribute} とパスワード(確認)が一致しません。', 'on'=>'register'), | |
| ... | |
| ); | |
| } | |
| protected function beforeSave() | |
| { | |
| $ph = new PasswordHash( | |
| Yii::app()->params['iteration_count_log2'], | |
| Yii::app()->params['portable_hashes'] | |
| ); | |
| $this->password = $ph->HashPassword($this->password); | |
| ... | |
| return parent::beforeSave(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment