I don’t think that is the default functionality though is it?
This is confusing the sh*t out of me now! Everything is a mess!
I don’t think that is the default functionality though is it?
This is confusing the sh*t out of me now! Everything is a mess!
Well, if you are using UserIdentity class and have in the config such strings:
'components'=>array(
'user'=>array(
'loginUrl'=>array('site/login'),
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
),
and also your backend’s SiteController has accessControl filter and rules:
public function filters()
{
return array(
'accessControl',
);
}
public function accessRules()
{
return array(
array('allow',
'users'=>array('*'),
'actions'=>array('login'),
),
array('allow',
'users'=>array('@'),
),
array('deny',
'users'=>array('*'),
),
);
}
then, when you are not logged in and try to access SiteController/actionIndex, you’ll be redirected to the SiteController/actionLogin, which has the following code:
public function actionLogin()
{
$form=new LoginForm;
// collect user input data
if(isset($_POST['LoginForm']))
{
$form->attributes=$_POST['LoginForm'];
$form->rememberMe=false;
// validate user input and redirect to previous page if valid
if($form->validate())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->render('login',array('form'=>$form));
}
It is described in the guide: http://www.yiiframework.com/doc/guide/topics.auth
Cheers andy.
Now the yiic shell does not seem to work with the admin section. I typed the following:
php protected/yiic shell backend.php
Nothing happens, just a blank line.
The front-end yiic shell works OK.
Any idea what it could be?
The problem seems to being caused by these 3 lines in the backend config file:
‘controllerPath’ => $backend.’/controllers’,
‘viewPath’ => $backend.’/views’,
‘runtimePath’ => $backend.’/runtime’,
If I comment these lines out the yiic shell works OK, but it is for the frontend! Any idea how to fix this?
Any idea andy_s?
I think there can be two reasons: you set accessRules so yiic can’t access your backend application, or you need to edit config/console.php. Didn’t try it actually. Maybe just do crud for the front-end and then copy generated code to the backend part?