public function actionSignup()
 {
     $model = new User();
     $model->setScenario('signup');
     if ($model->load($_POST) && $model->save()) {
         if (Yii::$app->getUser()->login($model)) {
             return $this->goHome();
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
 public function actionSignup()
 {
     $model = new User();
     $model->setScenario('signup');
     if ($model->load($_POST)) {
         if ($model->save()) {
             if (Yii::$app->getUser()->login($model)) {
                 return $this->goHome();
             }
         } else {
             Yii::$app->getSession()->setFlash(Alert::TYPE_DANGER, Yii::t('gromver.platform', 'The form is filled incorrectly.'));
         }
     }
     $this->module->layout = $this->module->loginLayout;
     return $this->render('signup', ['model' => $model]);
 }
 public function up()
 {
     // Creates the default admin user
     $adminUser = new User();
     $adminUser->setScenario('signup');
     $adminUser->username = '******';
     $adminUser->status = User::STATUS_ACTIVE;
     echo 'Please type the admin user info: ' . PHP_EOL;
     $this->readStdinUser('Email (e.g. admin@mydomain.com)', $adminUser, 'email');
     //$this->readStdinUser('Type Username', $adminUser, 'username', $adminUser->email);
     $this->readStdinUser('Type Password', $adminUser, 'password', 'admin');
     if (!$adminUser->save()) {
         throw new \yii\console\Exception('Error when creating admin user.');
     }
     echo 'User created successfully.' . PHP_EOL;
 }