Authorization After Registration

Hi all! It took that if after the registration occurred automatic Authorization… For this I created actionRegistration()

public function actionRegistration()


		$model = new User;





                        if ($model->save()) {

                           $identity = new UserIdentity($model->name, $model->password);


                           Yii::app()->user->login(new UserIdentity($identity));





                if (Yii::app()->user->isGuest) {






After post form, i see errors…

Missing argument 2 for CUserIdentity::__construct(), called in 

public\protected\controllers\SiteController.php on line 173 and defined



43 public function __construct($username,$password)

44    {

45         $this->username=$username;

46         $this->password=$password;

47     } 

my UserIdentity class

class UserIdentity extends CUserIdentity


        private $_id;


	public function authenticate()


            $username = strtolower($this->name);

            $user = User::model()->find('LOWER(name)=?', array($username));


            if ($user===null) 


            else if(!$user->validatePassword($this->password))







            return $this->errorCode==self::ERROR_NONE;



        public function getId(){

            return $this->_id;



Help to optimize it plase… I am new to yii…

The missing argument error is due to second parameter not given for Yii::app()->user->login . The second parameter is an integer value for duration. Also, the first parameter is authenticated useridentity value.