Password Validation In Yii Model

From my sourcecode, I gave the information for password validation in yii framework. I used password and confirm password validation.

<?php
class User extends CActiveRecord
{
  public static function model($className=__CLASS__)
  {
      return parent::model($className);
  }
  public function tableName()
  {
      return 'tbl_user';
  }
  public function rules()
  {
            array('password', 'compare', 
                        'compareAttribute' => 'confirmpassword',
                        'on'=>'insert' 
            ),
  }
}
?>