Hi, i have a problem with login form. After i extends CWebUser and using it, the login form won’t redirect. this is my code:
// components/WebUser.php
class WebUser extends CWebUser
{
protected function afterLogin($fromCookie) {
parent::afterLogin($fromCookie);
file_put_contents(Yii::getPathOfAlias('webroot').'/afterLogin.txt',
"hello, after Login event\n".date('Y-m-d H:i:s'));
}
}
// config/main.php
..
'user'=>array(
'class' => 'WebUser',
'allowAutoLogin'=>true,
),
..
// SiteController.php
public function actionLogin() {
$model=new LoginForm;
if(isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if($model->validate() && $model->login()) {
$this->redirect(array('admin'));
}
}
}
sorry for my bad english . thanks