title: yii Call to undefined method in authenticate access rules section
body: <p>We have integrated the yii authenticate acceess rules. In the login page, after submit the 
  form, it displays the following error message shows</p>
  
  <p>Fatal error: Call to undefined method LoginForm::model() in D:\wamp\www\onlinetest\protected\components\UserIdentity.php on line 13</p>
  
  <p>Here is the controller code</p>
  
  <pre><code>public function actionLogin()
      {
          $model=new LoginForm;
  
          // if it is ajax validation request
          if(isset($_POST['ajax']) &amp;&amp; $_POST['ajax']==='login-form')
          {
              echo CActiveForm::validate($model);
              Yii::app()-&gt;end();
          }
  
          // collect user input data
          if(isset($_POST['LoginForm']))
          {
              $model-&gt;attributes=$_POST['LoginForm'];
              // validate user input and redirect to the previous page if valid
              if($model-&gt;validate() &amp;&amp; $model-&gt;login())
                  $this-&gt;redirect(Yii::app()-&gt;user-&gt;returnUrl);
          }
          // display the login form
          $this-&gt;render('login',array('model'=&gt;$model));
      }
  </code></pre>
  
  <p>Here is the login form model</p>
  
  <pre><code>class LoginForm extends CFormModel
  {
      public $username;
      public $password;
      public $rememberMe;
  
      private $_identity;
  
  
         public function tableName()
          {
                  return 'tbl_login';
          }
  
  
  
   public function authenticate($attribute,$params)
          {
                  if(!$this-&gt;hasErrors())  // we only want to authenticate when no input errors
                  {
                          $identity=new UserIdentity($this-&gt;username,$this-&gt;password);
                          $identity-&gt;authenticate();
                          switch($identity-&gt;errorCode)
                          {
                                  case UserIdentity::ERROR_NONE:
                                          Yii::app()-&gt;user-&gt;login($identity);
                                          break;
                                  case UserIdentity::ERROR_USERNAME_INVALID:
                                          $this-&gt;addError('username','Username is incorrect.');
                                          break;
                                  default: // UserIdentity::ERROR_PASSWORD_INVALID
                                          $this-&gt;addError('password','Password is incorrect.');
                                          break;
                          }
                  }
          }
  
  
      public function login()
      {
          if($this-&gt;_identity===null)
          {
              $this-&gt;_identity=new UserIdentity($this-&gt;username,$this-&gt;password);
              $this-&gt;_identity-&gt;authenticate();
          }
          if($this-&gt;_identity-&gt;errorCode===UserIdentity::ERROR_NONE)
          {
              $duration=$this-&gt;rememberMe ? 3600*24*30 : 0; // 30 days
              Yii::app()-&gt;user-&gt;login($this-&gt;_identity,$duration);
              return true;
          }
          else
              return false;
      }
  }
  </code></pre>
  
  <p>Here is the useridentity.php in components</p>
  
  <pre><code>class UserIdentity extends CUserIdentity
  {
     private $_id;
     public function authenticate()
     {
         $record=LoginForm::model()-&gt;findByAttributes(array('VarUser_type'=&gt;$this-&gt;username));  // here I use Email as user name which comes from database
         if($record===null)
                 {
                         $this-&gt;_id='user Null';
                                     $this-&gt;errorCode=self::ERROR_USERNAME_INVALID;
                 }
         else if($record-&gt;E_PASSWORD!==$this-&gt;password)            // here I compare db password with passwod field
                 {        $this-&gt;_id=$this-&gt;username;
                         $this-&gt;errorCode=self::ERROR_PASSWORD_INVALID;
                 }
  
  
         else
         {  
            $this-&gt;_id=$record['VarUser_type'];
             $this-&gt;setState('title', $record['VarUser_type']);
             $this-&gt;errorCode=self::ERROR_NONE;
  
         }
         return !$this-&gt;errorCode;
     }
  
     public function getId()       //  override Id
     {
  
         return $this-&gt;_id;
     }
  }
  </code></pre>
  
  <p>How can I fix this issue? If you know help me</p>