/** * Handle user input. */ public function listen() { if ($this->regView->registerButtonPost()) { $username = $this->regView->getUsername(); $password = $this->regView->getPassword(); $passwordRepeat = $this->regView->getPasswordRepeat(); try { if ($this->regModel->verifyRegisterCredentials($username, $password, $passwordRepeat)) { $this->logView->setCookieUsername($this->regView->getUsername()); $this->regView->redirectToLogin(); } } catch (RUsernameAndPasswordLengthException $e) { $this->regView->setMsgUsernameAndPasswordException(); } catch (RPasswordLengthException $e) { $this->regView->setMsgPassWordLengthException(); } catch (RUsernameLengthException $e) { $this->regView->setMsgUsernameLengthException(); } catch (RPasswordMismatchException $e) { $this->regView->setMsgPasswordMismatchException(); } catch (RUserExistsException $e) { $this->regView->setMsgUserExistsException(); } catch (RInvalidCharactersException $e) { $this->regView->setMsgInvalidCharacterException(); } } }