Yii Framework Forum: If not Login , Redirect to other Login page not default Login - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

If not Login , Redirect to other Login page not default Login If not Login , Redirect to other Login page not default Login Rate Topic: -----

#1 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 498
  • Joined: 21-May 11
  • Location:India

Posted 31 May 2012 - 01:41 AM

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...

Attached File(s)


Thanks,
Kiran Sharma.
0

#2 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 498
  • Joined: 21-May 11
  • Location:India

Posted 31 May 2012 - 02:36 AM

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.
Thanks,
Kiran Sharma.
0

#3 User is offline   riemann 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 31-August 11
  • Location:Algeria

Posted 31 May 2012 - 03:18 AM

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.yiiframew...mponents-detail
Hope this informations will be helpfull for you ^_^
2

#4 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 498
  • Joined: 21-May 11
  • Location:India

Posted 31 May 2012 - 03:35 AM

@riemann,
+1 for reply.
Thanks,
Kiran Sharma.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users