i have installed yii user and rights and upon login through "webapp/user/login" it directs me to the index.php page. i want to direct admin to another page rather then index.php page. which file would i need to edit to direct admin to the desired page. Help needed.
1条回答 默认 最新
- dpqjvoq9033 2015-11-08 16:28关注
you should have this code in you site/controller
/** * Displays the login page */ public function actionLogin() { $model=new LoginForm; // if it is ajax validation request if(isset($_POST['ajax']) && $_POST['ajax']==='login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if(isset($_POST['LoginForm'])) { $model->attributes=$_POST['LoginForm']; // validate user input and redirect to the previous page if valid if($model->validate() && $model->login()) // //this if you want redirect to returnUrl (index.php by default) // here you can change redirect to url you prefer // or render proper page // $this->redirect(Yii::app()->user->returnUrl); // this for your destination $this->redirect(array('story/create')); } // display the login form $this->render('login',array('model'=>$model)); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报