0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

modules/client/register: Support the inhibit_login option.

This commit is contained in:
Jason Volk 2019-01-12 12:34:34 -08:00
parent 0f6363f3e5
commit 8421dd46b6
3 changed files with 13 additions and 4 deletions

View file

@ -115,6 +115,7 @@ namespace ircd::m::name
constexpr const char *const username {"username"};
constexpr const char *const bind_email {"bind_email"};
constexpr const char *const auth {"auth"};
constexpr const char *const inhibit_login {"inhibit_login"};
constexpr const char *const visibility {"visibility"};
constexpr const char *const room_alias_name {"room_alias_name"};

View file

@ -25,7 +25,8 @@ struct ircd::m::registar
json::property<name::bind_email, bool>,
json::property<name::password, string_view>,
json::property<name::auth, json::object>,
json::property<name::device_id, string_view>
json::property<name::device_id, string_view>,
json::property<name::inhibit_login, bool>
>
{
using super_type::tuple;

View file

@ -121,9 +121,14 @@ try
"User registration for this server is disabled."
};
const bool &inhibit_login
{
json::get<"inhibit_login"_>(request)
};
const std::string response
{
register_user(request, &client, true)
register_user(request, &client, !inhibit_login)
};
// Send response to user
@ -237,11 +242,13 @@ register_user(const m::registar &request,
unquote(json::get<"device_id"_>(request))
};
const auto device_id
const m::id::device::buf device_id
{
requested_device_id?
m::id::device::buf{requested_device_id, my_host()}:
m::id::device::buf{m::id::generate, my_host()}
gen_token?
m::id::device::buf{m::id::generate, my_host()}:
m::id::device::buf{}
};
// 3.3.1 If true, the server binds the email used for authentication to the