2 different logins

question: i have 2 different sets of login/password, 1 is the access for an actual member that can create a company + staff , and the 2nd is the access for the staff , I now have this page

those company links above has this code




<?php echo CHtml::encode($data->getAttributeLabel('CompanyName')); ?>:</b>

<?php echo CHtml::link(CHtml::encode($data->CompanyName), array('view', 'id'=>$data->CompanyID)); ?>



what’s the best thing to do in order to redirect the user to a new login area and gets back to the correct page after…

now i have 2 login areas

  1. site/login

  2. companies/login

i add this to my companies controller




	public function accessRules()

	{

		return array(

			array(

					'allow',

					'actions' => array('index','login'),

					'users' => array('*'),

			),

            array(

                    'allow',

                    'actions' => array('view'),

                    'users' => array('@'),

            ),

   			array('deny',  // deny all users

				'users'=>array('*'),

			),

			

		);

	}



but then when i click the company link based from the screen shot, I get redirected to the

default yii login area, any suggestions/comments/brain dumps how to redirect to the 2nd login area i created ?

fixed by adding this to the user components




'loginUrl'=>'index.php?r=companies/login',



now my new problem is, when I login as a staff, it works, but then

when i go back to the index page, and click another company where this staff doesn’t belong to,

I can also see the page

Maybe this can help you:

http://www.yiiframework.com/forum/index.php?/topic/11882-setstatekeyprefix-and-auto-login-in-modules/page__view__findpost__p__58178

is this correct ?




	'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

                'loginUrl'=>array('site/login'),

	      ),

                'staffUser'=>array(

                       'allowAutoLogin'=>true,

                       'loginUrl'=>array('companies/login'),

                       'stateKeyPrefix'=>'staff_',

        ),



I based it from your example in your reply from that other thread

and am getting this error

It’s always good if you learn how to help yourself. So read the message carefully: It says, that you are missing the “class” element - now compare your configuration again with the example in my post. I think you should find the problem.

you using $filterchain as a object wich is not defined

EDIT: you need redeclare method fillterstuffaccess() or put in your controlerr

public $filterchain;

thanks, I have fixed this one, and I created a different thread for the other problem

http://www.yiiframework.com/forum/index.php?/topic/14139-removing-menu/