mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 11:48:54 +02:00
Merge branch 'master' of https://github.com/yangm97/construct
This commit is contained in:
commit
3fc4bac384
3 changed files with 15 additions and 6 deletions
|
@ -24,6 +24,7 @@ struct ircd::m::user::registar
|
||||||
:json::tuple
|
:json::tuple
|
||||||
<
|
<
|
||||||
json::property<name::username, json::string>,
|
json::property<name::username, json::string>,
|
||||||
|
json::property<name::type, json::string>,
|
||||||
json::property<name::bind_email, bool>,
|
json::property<name::bind_email, bool>,
|
||||||
json::property<name::password, json::string>,
|
json::property<name::password, json::string>,
|
||||||
json::property<name::auth, json::object>,
|
json::property<name::auth, json::object>,
|
||||||
|
|
|
@ -26,7 +26,7 @@ const
|
||||||
};
|
};
|
||||||
|
|
||||||
// We only support this for now, for some reason. TODO: XXX
|
// 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
|
throw m::UNSUPPORTED
|
||||||
{
|
{
|
||||||
"Registration '%s' not supported.", type
|
"Registration '%s' not supported.", type
|
||||||
|
@ -53,7 +53,7 @@ const
|
||||||
// 3.3.1 Required. The desired password for the account.
|
// 3.3.1 Required. The desired password for the account.
|
||||||
const auto &password
|
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
|
// (r0.3.0) 3.4.1 ID of the client device. If this does not correspond to a
|
||||||
|
@ -86,6 +86,7 @@ const
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if the password is acceptable for this server or throws
|
// Check if the password is acceptable for this server or throws
|
||||||
|
if(type != "m.login.application_service")
|
||||||
validate_password(password);
|
validate_password(password);
|
||||||
|
|
||||||
//TODO: ABA
|
//TODO: ABA
|
||||||
|
@ -113,6 +114,7 @@ const
|
||||||
// Set the password for the account. This issues an ircd.password state
|
// 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
|
// event to the user's room. User will be able to login with
|
||||||
// m.login.password
|
// m.login.password
|
||||||
|
if(type != "m.login.application_service")
|
||||||
user.password(password);
|
user.password(password);
|
||||||
|
|
||||||
// Represent the user's room; was created in m::create(user_id)
|
// Represent the user's room; was created in m::create(user_id)
|
||||||
|
@ -142,7 +144,7 @@ const
|
||||||
// Log the user in by issuing an event in the tokens room containing
|
// Log the user in by issuing an event in the tokens room containing
|
||||||
// the generated token. When this call completes without throwing the
|
// the generated token. When this call completes without throwing the
|
||||||
// access_token will be committed and the user will be logged in.
|
// 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];
|
char remote_buf[96];
|
||||||
const json::value last_seen_ip
|
const json::value last_seen_ip
|
||||||
|
|
|
@ -69,7 +69,13 @@ post__register(client &client,
|
||||||
json::get<"auth"_>(request)
|
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
|
return m::resource::response
|
||||||
{
|
{
|
||||||
client, http::UNAUTHORIZED, json::object{flows}
|
client, http::UNAUTHORIZED, json::object{flows}
|
||||||
|
|
Loading…
Reference in a new issue