getParsedBody(); $username = $parsedBody['username']; $password = $parsedBody['password']; //TODO: Confirm that someone is not sending garbage. // - There may only be the keys username and password - optional token // - None of the two/three fields may be empty. //TODO: Check username for allowed chars and length. $user['username'] = $username; $user['appstate'] = 0; return $response->withJson($user); } public static function getRoutes(): array { return [ new Route('POST', '/login', 'login'), ]; } }