kevindng
(Long Dhb)
March 16, 2013, 4:55am
1
i have configured two CWebUser object for backend/frontend in my web applications. But when I implement access control list on backend background, it allway used redirect login url default of user component. How to change login url for backend background
my config like
'user'=>array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'user_',
'loginUrl'=>array("site/login"),
),
'backendUser'=>array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'user_',
'loginUrl'=>array("backend/login"),
),
seenivasan
(Chellamnivas)
March 16, 2013, 6:29am
2
Dear Friend
If you are using a seperate module for backend, we can set the component in the init method of Module.php.
Yii::app()->setComponent('user',array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'admin_',
'loginUrl'=>array($this->id."/backend/login")
));
or
In our case essentially there is only change in loginUrl in configuring seperate CWebUser.
We can just add a line in init method instead of setting a new user component.
Yii::app()->user->loginUrl=array($this->id."/backend/login");
Regards.