protected function postProcess() { //validate try { $this->_validate(); } catch (\MyApp\Exception\InvalidEmail $e) { //echo $e->getMessage(); //exit; $this->setErrors('email', $e->getMessage()); } catch (\MyApp\Exception\InvalidPassword $e) { //echo $e->getMessage(); // exit; $this->setErrors('password', $e->getMessage()); } //echo "success"; //exit; $this->setValues('email', $_POST['email']); if ($this->hasError()) { return; } else { // create user try { $userModel = new \MyApp\Model\User(); $userModel->create(['club' => $_POST['club'], 'email' => $_POST['email'], 'password' => $_POST['password']]); } catch (\MyApp\Exception\DuplicateEmail $e) { $this->setErrors('email', $e->getMessage()); return; } //redirect to login header('Location:' . SITE_URL . '/login.php'); exit; } }