Example #1
0
 public function actionCreateAccount()
 {
     $this->layout = 'frontend';
     $model = new \app\models\Person(['scenario' => 'create']);
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             //Send activation email
             // Yii::$app->mailer->compose('/mail/default',[
             //     'auth_key' => $model->auth_key
             //     ])
             // ->setFrom('*****@*****.**')
             // ->setTo($model->email)
             // ->setSubject('Global Travel Alliance - Account Activation')
             // ->send();
             Yii::$app->user->login($model, 3600 * 24 * 30);
             // Yii::$app->session->setFlash('accountCreated');
             return $this->redirect(['/']);
         }
     }
     return $this->render('create-account', ['model' => $model]);
 }