/** * Create HTTP response * * Should be called after a login attempt has been determined * * @return void BUT writes to standard output and cookies! */ public function response() { $message = $this->getMessage(); if ($this->loginModel->userIsLoggedIn()) { return $this->generateLogoutButtonHTML($message); } return $this->generateLoginFormHTML($message); }
/** * @return bool - if the user is logged in or not */ public function doLoginAction() { if (!$this->loginModel->userIsLoggedIn() && $this->loginView->userWantsToLogin()) { $this->login(); } else { if ($this->loginModel->userIsLoggedIn() && $this->loginView->userWantsToLogout()) { $this->logout(); } } return $this->loginModel->userIsLoggedIn(); }