/** * Handle user input */ public function listen() { if ($this->logView->isRegisteredCookieSet()) { $this->logView->setMsgRegistered(); $this->logView->deleteRegisteredCookie(); if ($this->logView->isCookieNameSet()) { $this->logView->setLoginName($this->logView->getCookieName()); } } // Login if ($this->logView->loginButtonPost() && !$this->logModel->isLoggedIn()) { try { $this->login(); } catch (LUsernameMissingException $e) { $this->logView->setMsgUsernameMissing(); } catch (LPasswordMissingException $e) { $this->logView->setMsgPasswordMissing(); } catch (LUsernameOrPasswordException $e) { $this->logView->setMsgUsernameOrPassword(); } } else { if ($this->logView->isPost()) { $this->logView->redirect(); } else { if ($this->logView->isCookiesSet()) { try { $this->cookieLogin(); } catch (LWrongCookieInformationException $e) { $this->logView->deleteCredentialCookies(); $this->logView->setMsgWrongCookieInfo(); } } } } }