mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 13:01:07 +01:00
modules/client/register_available: Deny response when registration disabled.
This commit is contained in:
parent
3deeab99de
commit
73be558ff2
2 changed files with 21 additions and 0 deletions
|
@ -55,6 +55,7 @@ method_post
|
||||||
};
|
};
|
||||||
|
|
||||||
ircd::conf::item<bool>
|
ircd::conf::item<bool>
|
||||||
|
IRCD_MODULE_EXPORT
|
||||||
register_enable
|
register_enable
|
||||||
{
|
{
|
||||||
{ "name", "ircd.client.register.enable" },
|
{ "name", "ircd.client.register.enable" },
|
||||||
|
@ -103,6 +104,7 @@ post__register(client &client,
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::conf::item<bool>
|
ircd::conf::item<bool>
|
||||||
|
IRCD_MODULE_EXPORT
|
||||||
register_user_enable
|
register_user_enable
|
||||||
{
|
{
|
||||||
{ "name", "ircd.client.register.user.enable" },
|
{ "name", "ircd.client.register.user.enable" },
|
||||||
|
|
|
@ -40,10 +40,29 @@ validate_user_id
|
||||||
"client_register", "validate_user_id"
|
"client_register", "validate_user_id"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mods::import<ircd::conf::item<bool>>
|
||||||
|
register_enable
|
||||||
|
{
|
||||||
|
"client_register", "register_enable"
|
||||||
|
};
|
||||||
|
|
||||||
|
mods::import<ircd::conf::item<bool>>
|
||||||
|
register_user_enable
|
||||||
|
{
|
||||||
|
"client_register", "register_user_enable"
|
||||||
|
};
|
||||||
|
|
||||||
resource::response
|
resource::response
|
||||||
get__register_available(client &client,
|
get__register_available(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
|
if(!bool(register_enable) || !bool(register_user_enable))
|
||||||
|
throw m::error
|
||||||
|
{
|
||||||
|
http::FORBIDDEN, "M_REGISTRATION_DISABLED",
|
||||||
|
"Registration is disabled. No username is available."
|
||||||
|
};
|
||||||
|
|
||||||
// The successful construction of this m::user::id implies valid
|
// The successful construction of this m::user::id implies valid
|
||||||
// formatting otherwise an m::INVALID_MXID (400) is thrown.
|
// formatting otherwise an m::INVALID_MXID (400) is thrown.
|
||||||
m::user::id::buf user_id
|
m::user::id::buf user_id
|
||||||
|
|
Loading…
Reference in a new issue