protected function postProcess() { try { $this->_validate(); } catch (\MyApp\Exception\EmptyPost $e) { $this->setErrors('login', $e->getMessage()); } $this->setValues('club', $_POST['club']); if ($this->hasError()) { return; } else { try { $userModel = new \MyApp\Model\User(); $user = $userModel->login(['club' => $_POST['club'], 'password' => $_POST['password']]); } catch (\MyApp\Exception\UnmatchEmailOrPassword $e) { $this->setErrors('login', $e->getMessage()); return; } // login処理 session_regenerate_id(true); $_SESSION['me'] = $user; // redirect to home header('Location: ' . SITE_URL); exit; } }