0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/client: Cleanup/consistency in register/login handle stack.

This commit is contained in:
Jason Volk 2018-02-16 17:17:18 -08:00
parent 4c3d20d959
commit da9393016d
2 changed files with 20 additions and 18 deletions

View file

@ -148,7 +148,7 @@ post__login_password(client &client,
}
resource::response
post_login(client &client,
post__login(client &client,
const resource::request::object<body> &request)
{
const auto &type
@ -168,11 +168,11 @@ post_login(client &client,
resource::method
method_post
{
login_resource, "POST", post_login
login_resource, "POST", post__login
};
resource::response
get_login(client &client,
get__login(client &client,
const resource::request &request)
{
const json::member login_password
@ -197,5 +197,5 @@ get_login(client &client,
resource::method
method_get
{
login_resource, "GET", get_login
login_resource, "GET", get__login
};

View file

@ -42,7 +42,7 @@ static void validate_user_id(const m::id::user &user_id);
static void validate_password(const string_view &password);
resource::response
handle_post_kind_user(client &client,
post__register_user(client &client,
const resource::request::object<body> &request)
try
{
@ -171,7 +171,7 @@ catch(const m::INVALID_MXID &e)
};
resource::response
handle_post_kind_guest(client &client,
post__register_guest(client &client,
const resource::request::object<body> &request)
{
throw m::error
@ -203,7 +203,7 @@ handle_post_kind_guest(client &client,
}
resource::response
handle_post(client &client,
post__register(client &client,
const resource::request::object<body> &request)
{
const auto kind
@ -212,10 +212,10 @@ handle_post(client &client,
};
if(kind == "guest")
return handle_post_kind_guest(client, request);
return post__register_guest(client, request);
if(kind.empty() || kind == "user")
return handle_post_kind_user(client, request);
return post__register_user(client, request);
throw m::UNSUPPORTED
{
@ -223,17 +223,19 @@ handle_post(client &client,
};
}
resource register_resource
resource
register_resource
{
"/_matrix/client/r0/register",
{
"Register for an account on this homeserver. (3.3.1)"
"(3.3.1) Register for an account on this homeserver."
}
};
resource::method post
resource::method
method_post
{
register_resource, "POST", handle_post
register_resource, "POST", post__register
};
void