Ejemplo n.º 1
0
 /**
  * Handle user input.
  */
 public function listen()
 {
     if ($this->regView->registerButtonPost()) {
         $username = $this->regView->getUsername();
         $password = $this->regView->getPassword();
         $passwordRepeat = $this->regView->getPasswordRepeat();
         $name = $this->regView->getName();
         $contact = $this->regView->getContact();
         try {
             if ($this->regModel->verifyRegisterCredentials($username, $password, $passwordRepeat, $name, $contact)) {
                 $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();
         }
     }
 }