User is login to index page and when i put the logout URL in other tab of browser the user control are redirect to login page and the previous tab is also logout form there index page. I use this controller to login and logout the user. please help me what can i do for this if i login to user account then i all url is working for user index page. before logout.
public function actionLogin()
{
$model=new LoginForm;
// if it is ajax validation request
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login())
$this->redirect(array("site/index"));
}
// display the login form
Yii::app()->user->logout();
Yii::app()->user->clearStates();
$this->render('login',array('model'=>$model));
}
public function actionLogout()
{
Yii::app()->user->logout();
Yii::app()->user->clearStates();
$this->redirect(Yii::app()->homeUrl);
}