Problem With App()->User->Returnurl

Hi, I have problem with Yii::app()->user->returnUrl. The returnUrl refers to example.com/site/index instead of example.com/admin/site/index/

protected/components/UserIdentity.php




public function authenticate()

{

    $user = User::model()->findByAttributes(array('username'=>$this->username));

    if ($user === null) {

        $this->errorCode=self::ERROR_USERNAME_INVALID;

    }

    elseif($user['password'] !== $this->password) {

        $this->errorCode=self::ERROR_PASSWORD_INVALID;

    }

    else

    {

        $this->errorCode=self::ERROR_NONE;

        $this->setState('type', $user->user_type);

        $this->setState('fullName', $user->full_name);

        $this->_id = $user->id;

    }

    return !$this->errorCode;

}



protected/models/User.php




public function login()

{

    if($this->_identity===null)

    {

        $this->_identity=new UserIdentity($this->username,$this->password);

        $this->_identity->authenticate();

    }

    if($this->_identity->errorCode===UserIdentity::ERROR_NONE)

    {

        Yii::app()->user->login($this->_identity);

        return true;

    }

    else

        return false;

}



protected/modules/admin/controllers/UserController.php




public function actionLogin()

{

    $model=new User('login');

    if(isset($_POST['User']))

    {

        $model->attributes=$_POST['User'];

        if($model->validate() && $model->login())

        $this->redirect(Yii::app()->user->returnUrl);

    }

    // display the login form

    $this->render('login',array('model'=>$model));

}


public function actionLogout()

{

    Yii::app()->user->logout();

    $this->redirect($this->createUrl('home/index'));

}



Can you help me? How to refer to admin module after login?

Try setting URL with $this->createAbsoluteUrl() instead.

It does not work.