response->getStatus() !== ServerStatus::OK) { return; } $json = json_decode($this->requestBody); $session = new Session(); if ($session->IsLoggedIn()) { $this->response = new ApiJsonResponse(ServerStatus::BAD_REQUEST); $this->response->setParameter('success', false); $this->response->setMessage('You are already logged in!'); return; } if (!$session->Login($json->username, $json->password)) { $this->response = new ApiJsonResponse(ServerStatus::UNAUTHORIZED); $this->response->setParameter('success', false); $this->response->setMessage('Login failed!'); return; } $this->response = new ApiJsonResponse(); } }