0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00
This commit is contained in:
Jason Volk 2020-04-15 16:25:59 -07:00
commit 3fc4bac384
3 changed files with 15 additions and 6 deletions

View file

@ -24,6 +24,7 @@ struct ircd::m::user::registar
:json::tuple
<
json::property<name::username, json::string>,
json::property<name::type, json::string>,
json::property<name::bind_email, bool>,
json::property<name::password, json::string>,
json::property<name::auth, json::object>,

View file

@ -26,7 +26,7 @@ const
};
// We only support this for now, for some reason. TODO: XXX
if(type && type != "m.login.dummy")
if(type && (type != "m.login.dummy" && type != "m.login.application_service"))
throw m::UNSUPPORTED
{
"Registration '%s' not supported.", type
@ -53,7 +53,7 @@ const
// 3.3.1 Required. The desired password for the account.
const auto &password
{
json::at<"password"_>(*this)
json::get<"password"_>(*this)
};
// (r0.3.0) 3.4.1 ID of the client device. If this does not correspond to a
@ -86,7 +86,8 @@ const
};
// Check if the password is acceptable for this server or throws
validate_password(password);
if(type != "m.login.application_service")
validate_password(password);
//TODO: ABA
if(exists(user_id))
@ -113,7 +114,8 @@ const
// Set the password for the account. This issues an ircd.password state
// event to the user's room. User will be able to login with
// m.login.password
user.password(password);
if(type != "m.login.application_service")
user.password(password);
// Represent the user's room; was created in m::create(user_id)
m::user::room user_room
@ -142,7 +144,7 @@ const
// Log the user in by issuing an event in the tokens room containing
// the generated token. When this call completes without throwing the
// access_token will be committed and the user will be logged in.
if(!json::get<"inhibit_login"_>(*this))
if(type != "m.login.application_service" && !json::get<"inhibit_login"_>(*this))
{
char remote_buf[96];
const json::value last_seen_ip

View file

@ -69,7 +69,13 @@ post__register(client &client,
json::get<"auth"_>(request)
};
if(empty(auth))
const auto &type
{
json::get<"type"_>(request)
};
if(empty(auth) && type != "m.login.application_service")
return m::resource::response
{
client, http::UNAUTHORIZED, json::object{flows}