Exemplo n.º 1
0
 public function actionSignup()
 {
     $authProviderName = Yii::$app->session->get('game/register/authProviderName');
     $authProviderTitle = Yii::$app->session->get('game/register/authProviderTitle');
     $externalUserAttributes = Yii::$app->session->get('game/register/attributes');
     $model = new SignupForm();
     $model->setAuthProviderName($authProviderName);
     $model->setAuthProviderTitle($authProviderTitle);
     $model->externalUserAttributes = $externalUserAttributes;
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             Yii::$app->session->remove('game/register/authProvider');
             Yii::$app->session->remove('game/register/attributes');
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     } else {
         $model->username = $model->getExternalUserName();
     }
     return $this->render('signup', ['model' => $model]);
 }