Possible bug in CWebUser::setFlash

I’m not sure wether this is a bug or intended behaviour or just a user problem (I’m fairly new to Yii):

I’m implementing a change password mechanism that should log the user out on success so he has to login with the new password he just created. I want to show a message that tells the user what happened. Flash messages auto display on top of any page if they exist. In this situation the flash doen’t get set.

Here’s my Controller code:




public function actionChange()

{

	$model=new ChangePasswordForm;

	

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

	{

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


		if($model->validate())

		{	

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

			Yii::app()->user->setFlash('success',"Your password was changed. Please login with your new password now");

			$this->redirect(Yii::app()->createAbsoluteUrl('site/login'));

		}

	}

	

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

}




You can use logout(false). See here.

Yep, that worked - Thanks for the swift reply!!