mirror of
https://github.com/matrix-construct/construct
synced 2024-10-03 22:28:52 +02:00
ircd:Ⓜ️:login: Use json::string rather than string_view in tuple types; simplify.
This commit is contained in:
parent
0644db459c
commit
7d449e6e56
2 changed files with 20 additions and 15 deletions
|
@ -21,33 +21,33 @@ struct ircd::m::login
|
|||
<
|
||||
/// Required. The login type being used. One of: ["m.login.password",
|
||||
/// "m.login.token"]
|
||||
json::property<name::type, string_view>,
|
||||
json::property<name::type, json::string>,
|
||||
|
||||
/// The fully qualified user ID or just local part of the user ID, to
|
||||
/// log in.
|
||||
json::property<name::user, string_view>,
|
||||
json::property<name::user, json::string>,
|
||||
|
||||
/// When logging in using a third party identifier, the medium of the
|
||||
/// identifier. Must be 'email'.
|
||||
json::property<name::medium, string_view>,
|
||||
json::property<name::medium, json::string>,
|
||||
|
||||
/// Third party identifier for the user.
|
||||
json::property<name::address, string_view>,
|
||||
json::property<name::address, json::string>,
|
||||
|
||||
/// Required when type is m.login.password. The user's password.
|
||||
json::property<name::password, string_view>,
|
||||
json::property<name::password, json::string>,
|
||||
|
||||
/// Required when type is m.login.token. The login token.
|
||||
json::property<name::token, string_view>,
|
||||
json::property<name::token, json::string>,
|
||||
|
||||
/// ID of the client device. If this does not correspond to a known client
|
||||
/// device, a new device will be created. The server will auto-generate a
|
||||
/// device_id if this is not specified.
|
||||
json::property<name::device_id, string_view>,
|
||||
json::property<name::device_id, json::string>,
|
||||
|
||||
/// A display name to assign to the newly-created device. Ignored if
|
||||
/// device_id corresponds to a known device.
|
||||
json::property<name::initial_device_display_name, string_view>
|
||||
json::property<name::initial_device_display_name, json::string>
|
||||
>
|
||||
{
|
||||
using super_type::tuple;
|
||||
|
|
|
@ -33,12 +33,12 @@ post__login_password(client &client,
|
|||
// Build a canonical MXID from a the user field
|
||||
const m::id::user::buf user_id
|
||||
{
|
||||
unquote(at<"user"_>(request)), my_host()
|
||||
at<"user"_>(request), my_host()
|
||||
};
|
||||
|
||||
const auto &supplied_password
|
||||
const string_view &supplied_password
|
||||
{
|
||||
unquote(at<"password"_>(request))
|
||||
at<"password"_>(request)
|
||||
};
|
||||
|
||||
m::user user
|
||||
|
@ -58,9 +58,14 @@ post__login_password(client &client,
|
|||
"Access denied."
|
||||
};
|
||||
|
||||
const auto requested_device_id
|
||||
const string_view &requested_device_id
|
||||
{
|
||||
unquote(json::get<"device_id"_>(request))
|
||||
json::get<"device_id"_>(request)
|
||||
};
|
||||
|
||||
const string_view &initial_device_display_name
|
||||
{
|
||||
json::get<"initial_device_display_name"_>(request)
|
||||
};
|
||||
|
||||
const auto device_id
|
||||
|
@ -104,7 +109,7 @@ post__login(client &client,
|
|||
{
|
||||
const auto &type
|
||||
{
|
||||
unquote(at<"type"_>(request))
|
||||
at<"type"_>(request)
|
||||
};
|
||||
|
||||
if(type == "m.login.password")
|
||||
|
@ -112,7 +117,7 @@ post__login(client &client,
|
|||
|
||||
throw m::UNSUPPORTED
|
||||
{
|
||||
"Login type is not supported."
|
||||
"Login type '%s' is not supported.", type
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue