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:
parent
0f6363f3e5
commit
8421dd46b6
3 changed files with 13 additions and 4 deletions
|
@ -115,6 +115,7 @@ namespace ircd::m::name
|
||||||
constexpr const char *const username {"username"};
|
constexpr const char *const username {"username"};
|
||||||
constexpr const char *const bind_email {"bind_email"};
|
constexpr const char *const bind_email {"bind_email"};
|
||||||
constexpr const char *const auth {"auth"};
|
constexpr const char *const auth {"auth"};
|
||||||
|
constexpr const char *const inhibit_login {"inhibit_login"};
|
||||||
|
|
||||||
constexpr const char *const visibility {"visibility"};
|
constexpr const char *const visibility {"visibility"};
|
||||||
constexpr const char *const room_alias_name {"room_alias_name"};
|
constexpr const char *const room_alias_name {"room_alias_name"};
|
||||||
|
|
|
@ -25,7 +25,8 @@ struct ircd::m::registar
|
||||||
json::property<name::bind_email, bool>,
|
json::property<name::bind_email, bool>,
|
||||||
json::property<name::password, string_view>,
|
json::property<name::password, string_view>,
|
||||||
json::property<name::auth, json::object>,
|
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;
|
using super_type::tuple;
|
||||||
|
|
|
@ -121,9 +121,14 @@ try
|
||||||
"User registration for this server is disabled."
|
"User registration for this server is disabled."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const bool &inhibit_login
|
||||||
|
{
|
||||||
|
json::get<"inhibit_login"_>(request)
|
||||||
|
};
|
||||||
|
|
||||||
const std::string response
|
const std::string response
|
||||||
{
|
{
|
||||||
register_user(request, &client, true)
|
register_user(request, &client, !inhibit_login)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send response to user
|
// Send response to user
|
||||||
|
@ -237,11 +242,13 @@ register_user(const m::registar &request,
|
||||||
unquote(json::get<"device_id"_>(request))
|
unquote(json::get<"device_id"_>(request))
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto device_id
|
const m::id::device::buf device_id
|
||||||
{
|
{
|
||||||
requested_device_id?
|
requested_device_id?
|
||||||
m::id::device::buf{requested_device_id, my_host()}:
|
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
|
// 3.3.1 If true, the server binds the email used for authentication to the
|
||||||
|
|
Loading…
Reference in a new issue