コード例 #1
0
ファイル: WebUser.php プロジェクト: xexys/xca-backend
 public function getModel()
 {
     if (!$this->isGuest && $this->_model === null) {
         $this->_model = User::model()->with('role')->findByPk($this->id);
     }
     return $this->_model;
 }
コード例 #2
0
ファイル: UserIdentity.php プロジェクト: xexys/xca-backend
 public function authenticate()
 {
     //$user = User::model()->notDeleted()->findByAttributes(array('email'=>$this->email));
     $user = User::model()->find(array('condition' => "email=:email", 'params' => array(':email' => $this->email)));
     if ($user === null) {
         $this->errorCode = self::ERROR_EMAIL_INVALID;
     } elseif ($user->password !== $this->password) {
         // TODO: Сделать проверку по хешу
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $user->id;
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }