If not Login , Redirect to other Login page not default Login

I have different module(A,B,C) which are only accessible to authenticate users,

I set login link on admin module page on ?r=admin/login/site/login which is fine.

now when i click on any module link from menu without login it redirects me to ?r=site/login ( which is default login ).

what i want is to redirect on ?r=admin/login/site/login when click on menu without login.

see attached image for more idea…

I got answer of redirecting on particular module page after login,

i use as,


$this->redirect(Yii::app()->homeUrl.'?r=admin/ModuleA/Module_A_Controller/Module_A_action');

but how i can redirect on particular page is user is not login… please see topic start post.

Hi,

To change the default login page in your module you can modify user component in your AdminModule.php

by adding in init() method




Yii::app()->setComponents(array(

               'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

			'loginUrl' => array

		    (

		        '0' => 'admin/login/site/login'

		    )

		),

        ));



and for the default controller you can modify homeUrl property by adding in your AdminModule.php->init()


Yii::app()->homeUrl = "path to your action";

For more information consider to see the doc http://www.yiiframework.com/doc/api/1.1/CModule#setComponents-detail

Hope this informations will be helpfull for you ^_^

@riemann,

+1 for reply.