0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-17 16:08:37 +02:00

modules/client/register: Allow flows request before denying registration otherwise Riot infinite-loops.

This commit is contained in:
Jason Volk 2019-03-02 15:58:16 -08:00
parent 47bcfaecb4
commit 3deeab99de

View file

@ -67,13 +67,6 @@ resource::response
post__register(client &client, post__register(client &client,
const resource::request::object<m::registar> &request) const resource::request::object<m::registar> &request)
{ {
if(!bool(register_enable))
throw m::error
{
http::UNAUTHORIZED, "M_REGISTRATION_DISABLED",
"Registration for this server is disabled."
};
const json::object &auth const json::object &auth
{ {
json::get<"auth"_>(request) json::get<"auth"_>(request)
@ -85,6 +78,13 @@ post__register(client &client,
client, http::UNAUTHORIZED, json::object{flows} client, http::UNAUTHORIZED, json::object{flows}
}; };
if(!bool(register_enable))
throw m::error
{
http::FORBIDDEN, "M_REGISTRATION_DISABLED",
"Registration for this server is disabled."
};
const auto kind const auto kind
{ {
request.query["kind"] request.query["kind"]
@ -117,7 +117,7 @@ try
if(!bool(register_user_enable)) if(!bool(register_user_enable))
throw m::error throw m::error
{ {
http::UNAUTHORIZED, "M_REGISTRATION_DISABLED", http::FORBIDDEN, "M_REGISTRATION_DISABLED",
"User registration for this server is disabled." "User registration for this server is disabled."
}; };