2013-07-29 2 views
3

이 오류가 발생합니다yii에 등록한 후 자동 로그인 및 리디렉션하는 방법? 나는 자동 로그인 후 기능을 재 사용하는 경우

에도 session_regenerate_id() : 세션 오브젝트 파괴가

사람이 나를 간염 할 수 실패?

<?php 
public function actionRegister() 
{ 
    $model = new UserProfileForm; 

    $this->performAjaxValidation($model,'userProfile-form'); 

    if(isset($_POST['UserProfileForm'])) 
    { 
     $model->attributes = $_POST['UserProfileForm']; 
     if ($model->save()) 
     { 
      $u = new LoginForm; 
      $u->username = $model->username; 
      $u->password = $model->password; 
      $u->login(); 

      $this->redirect(Yii::app()->user->returnUrl); 
     } 
    } 
    $this->render('register',array('model'=>$model,)); 
} 

?>

+0

반복된다? – msoa

+0

@msoa 예 Firefox에이 문제가 있습니다! – sj59

답변

2

다음 작품.

if($model->save()){    

    $identity=new UserIdentity($model->username,$model->password); 
    $identity->authenticate(); 
    Yii::app()->user->login($identity); 

    $this->redirect(Yii::app()->user->returnUrl);     
} 

PS : $model->save() 실행 $model->validate()은 그래서 당신은 당신이 파이어 폭스에이 문제가 자신

+0

답변 해 주셔서 감사합니다.하지만 작동하지 않습니다! (같은 오류). – sj59

관련 문제