I have two controllers sitecontroller and usercontroller inside protected/controllers folder.the register
action is defined inside the usercontroller.php file and this actionregister method renders the register.php view file(containing registration form) found inside protected/views/user/ folder. but when i put index.php?r=user/register in the url, it automatically redirects to index.php?r=site/login which is the login form.given below is the code of actionregister method.
public function actionRegister()
{
$model=new User('register');
// uncomment the following code to enable ajax-based validation
if(isset($_POST['ajax']) && $_POST['ajax']==='user-register-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->validate())
{
// form inputs are valid, do something here
//return;
$model->save();
//$this->redirect($this->render('finished',array('form'=>$form)));
$this->redirect(Yii::app()->user->returnUrl);
}
}
$this->render('register',array('model'=>$model));
}
what may be the reason for this?