public function actionSignin(User $user, CSRF $CSRF)
 {
     $placeholders = [];
     if ($user->isLogged()) {
         $placeholders['content'] = $this->getMessageLogout($CSRF, 'loginLogout');
         return $this->render('success', $placeholders);
     }
     $model = new SigninForm();
     // redirect
     Event::on($model, SigninForm::EVENT_AFTER_LOGIN, function (ModelEvent $event) use($user) {
         $this->login($user, $event->result);
         $this->response->refresh()->send(true);
     });
     $model->load($_POST);
     $placeholders['model'] = $model;
     return $this->render('index', $placeholders);
 }
 public function actionSignup(User $user, CSRF $CSRF, Session $session, Mail $mail)
 {
     if ($user->isLogged()) {
         $placeholders['content'] = $this->getMessageLogout($CSRF, 'signupLogout');
         return $this->render('success', $placeholders);
     }
     if (($message = $session->getFlash($this->keySessionFlash)) && isset($message['email'])) {
         $placeholders['content'] = $this->template->getChunk('@common.views/elements/alert-success', ['output' => i18n::t($this->keySessionFlash, ['email' => $message['email']])]);
         return $this->render('success', $placeholders);
     }
     $model = new SignupForm();
     // redirect
     Event::on($model, SignupForm::EVENT_AFTER_SIGNUP, function (ModelEvent $event) use($session, $mail, $model) {
         $this->sendMail($mail, $event->result, $model);
         $session->setFlash('successSignup', ['email' => $event->result->email]);
         $this->response->refresh()->send(true);
     });
     $model->load($_POST);
     $placeholders['model'] = $model;
     return $this->render('index.php', $placeholders);
 }