User Logout

The function “logout” isn’t working… yii::app()->user->logout(true)

it’s the login part:


    public function actionLogin()

    {

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

            $this->redirect('index.html');

        $this->addStyle('login_box');


        $model = new Login();

        if( isset($_POST[get_class($model)]) )

        {

            $model->attributes = $_POST[ get_class($model) ];

            if($model->validate())

            {

                Yii::app()->user->login( new CUserIdentity($model->username,$model->password) );

                $this->redirect('index.html');

            }

            else if(Attempts::getAttempts() < Attempts::MAX_ATTEMPTS)

                Attempts::addAttempt();

        }


        $this->render('login',array(

            'model' => $model

        ));

    }

and it’s the logout part


    public function actionLogout()

    {

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

            $this->redirect('index.html');


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

        $this->redirect('index.html');

    }

but it’s not logout from the user…

How do I fix it?

b.t.w it’s the config


<?php

/**

 * Date: 07/05/13

 * Time: 21:34

 * Version: 1.0.0

 */


return array(

    'name' => 'שולח אימייל',


    'components' => array(

        'db' => array(

            'connectionString' => 'mysql:host=localhost;dbname=mailsend',

            'username' => 'root',

            'password' => '',

            'charset'  => 'utf8'

        ),

        'user' => array(

            'class' => 'WebUser'

        ),

        'urlManager' => array(

            'urlFormat' => 'path',

            'rules' => array(

                '<action:(index)>.html' => 'site/<action>',

                '<action:(login|logout)>.html' => 'user/<action>'

            )

        )

    ),


    'import' => array(

        'application.models.*',

        'application.controllers.*',

        'application.components.*'

    )

);

?>

You’re redirecting before calling the logout method.





public function actionLogout()

{

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

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

		

	$this->redirect('index.html');

}



I’m idiot,

Thanks for help ;)