From 8421dd46b6ff6cf0bc3c9876715be919205b804a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 12 Jan 2019 12:34:34 -0800 Subject: [PATCH] modules/client/register: Support the inhibit_login option. --- include/ircd/m/name.h | 1 + include/ircd/m/register.h | 3 ++- modules/client/register.cc | 13 ++++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/ircd/m/name.h b/include/ircd/m/name.h index 47985c2e6..1545bc01b 100644 --- a/include/ircd/m/name.h +++ b/include/ircd/m/name.h @@ -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"}; diff --git a/include/ircd/m/register.h b/include/ircd/m/register.h index 37cef7d08..f605050c1 100644 --- a/include/ircd/m/register.h +++ b/include/ircd/m/register.h @@ -25,7 +25,8 @@ struct ircd::m::registar json::property, json::property, json::property, - json::property + json::property, + json::property > { using super_type::tuple; diff --git a/modules/client/register.cc b/modules/client/register.cc index f6f948fe9..c5fd6f41a 100644 --- a/modules/client/register.cc +++ b/modules/client/register.cc @@ -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