/**
  * Регистрация
  * @return array|string|Response
  */
 public function actionSignup()
 {
     $user = new models\User(['scenario' => 'signup']);
     $profile = new models\Profile(['scenario' => 'signup']);
     if ($user->load(Yii::$app->request->post()) && $profile->load(Yii::$app->request->post())) {
         if ($user->validate() && $profile->validate()) {
             $user->populateRelation('profile', $profile);
             if ($user->save(false)) {
                 if ($this->module->requireEmailConfirmation === true) {
                     Yii::$app->consoleRunner->run('users/control/send-email ' . $user->email . ' signup "' . Yii::t('users', 'SUBJECT_SIGNUP') . '"');
                     Yii::$app->session->setFlash('success', Yii::t('users', 'SUCCESS_SIGNUP_WITHOUT_LOGIN', ['url' => Url::toRoute('resend')]));
                 } else {
                     Yii::$app->user->login($user);
                     Yii::$app->session->setFlash('success', Yii::t('users', 'SUCCESS_SIGNUP_WITH_LOGIN'));
                 }
                 return $this->redirect(['login']);
             } else {
                 Yii::$app->session->setFlash('danger', Yii::t('users', 'FAIL_SIGNUP'));
                 return $this->refresh();
             }
         } else {
             if (Yii::$app->request->isAjax) {
                 Yii::$app->response->format = Response::FORMAT_JSON;
                 return ActiveForm::validate($user);
             }
         }
     }
     return $this->render('signup', ['user' => $user, 'profile' => $profile]);
 }