Add username check logic

This commit is contained in:
Jordan Bancino 2022-12-14 21:23:20 +00:00
parent 5080d066ab
commit d48b6fc456

View file

@ -70,6 +70,14 @@ ROUTE_IMPL(RouteRegister, args)
if (HttpRequestMethodGet(args->context) == HTTP_GET &&
MATRIX_PATH_EQUALS(pathPart, "available"))
{
char *username = HashMapGet(HttpRequestParams(args->context), "username");
if (!username)
{
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);
response = MatrixErrorCreate(M_MISSING_PARAM);
}
/* TODO: Check if ?username=x is available */
}
else if (HttpRequestMethodGet(args->context) == HTTP_POST &&