Unexpected Redirection

Hello,

I’ve created a module “cms”. It’s working well, but when session expires then it redirecting horribly.

When session expires and some one navigate to other page then it try to redirect to login page but doesn’t goes to login page because it always redirects after redirects as non ending loop.

When browser breaks redirection and prompt with a message:

The code that I’ve written in CmsModule is:




public function beforeControllerAction($controller, $action) {

	if (parent::beforeControllerAction($controller, $action)) {


    	$route = $controller->id . '/' . $action->id;

    	$controller->layout = "wow_column2";

    	$app = Yii::app();


    	if (!$this->allowIP($app->getRequest()->getUserHostAddress()) && !($route == 'default/error' || $route == 'site/error')) {

        	throw new CHttpException(403, "You are not authorized to access this page on {$app->getRequest()->getUserHostAddress()}");

    	}


    	$publicPages = array(

        	'site/login',

        	'default/error',

    	);

    	if ($app->user->getIsGuest() && !in_array($route, $publicPages)) {

        	$app->user->loginRequired();

    	} else {

        	return true;

    	}

	}


	return false;

}



Thanks

Hi,

What is your $app->user->loginUrl ?

d

$app->user->loginUrl is "site/login"