コード例 #1
0
 public function process()
 {
     $this->validate();
     if (!$this->hasErrors()) {
         if (($model = Yii::app()->getUser()->getModel()) !== null) {
             return $model->saveAttributes(array('password' => UserHelper::encryptPassword($this->newPassword)));
         }
     }
     return false;
 }
コード例 #2
0
ファイル: UserIdentity.php プロジェクト: jayrulez/kcconline
 public function authenticate()
 {
     $user = User::model()->findByPk($this->username);
     if ($user === null) {
         $this->errorCode = self::ERROR_ID_NUMBER_INVALID;
     } else {
         if ($user->password !== UserHelper::encryptPassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->_id = $user->uid;
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return !$this->errorCode;
 }
コード例 #3
0
ファイル: User.php プロジェクト: jayrulez/kcconline
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         $this->email_address = strtolower($this->email_address);
         if ($this->getIsNewRecord()) {
             $this->password = UserHelper::encryptPassword($this->password);
             $this->deleted = 0;
             $this->datetime_created = new CDbExpression('now()');
         } else {
             $this->last_modified = new CDbExpression('now()');
         }
         return true;
     }
     return false;
 }