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