title: How to call yii component useridentity class from controller
body: <p>I am trying to create a simple login using Yii Here is my auth controller</p>
  
  <pre><code>class AuthController  extends Controller
  {
      /**
      * Declare class-based actions.
      */
      public function actionLogin()
      {
          $model = new LoginForm;
          $post = Yii::app()-&gt;request-&gt;getPost('LoginForm');
          // If form is submitted
          if($post) {
              $identity = new UserIdentity($post['username'], $post['password']);
              echo $identity-&gt;testing();
              if($identity-&gt;authenticate()) {
                  echo 'yes';
              } else {
                  echo 'no';
              }
              exit;
          }
          $this-&gt;render('login', array('model' =&gt; $model));   
      }
  }
  </code></pre>
  
  <p>And here is my UserIdentity</p>
  
  <pre><code>class UserIdentity extends CUserIdentity
  {
  
  
      private $_id;
  
      public function authenticate()
      {   echo 'testing';
          $user = LoginForm::model()-&gt;findByAttributes(array('username' =&gt; $this-&gt;username));
          if(is_null($user)) {
              %this-&gt;errorCode=self::ERROR_USERNAME_INVALID;
          } else if($user-&gt;password != $this-&gt;password) {
              $this-&gt;errorCode=self::ERROR_PASSWORD_INVALID;
          } else {
              $this-&gt;_id = $user-&gt;id;
              $this-&gt;errorCode=self::ERROR_NONE;
          }
  
          return !$this-&gt;errorCode;
      }
  
      function getId()
      {
          return $this-&gt;_id;
      }
  }
  </code></pre>
  
  <p>I have mentioned echo 'yes' and echo 'no' but both are not displaying. How to correct it</p>