diff --git a/modules/client/login.cc b/modules/client/login.cc index e59eb07bf..2787882e9 100644 --- a/modules/client/login.cc +++ b/modules/client/login.cc @@ -28,12 +28,6 @@ resource login_resource "they can use to authorize themself in subsequent requests. (3.2.2)" }; -const auto home_server -{ - // "The hostname of the homeserver on which the account has been registered." - "cdc.z" -}; - namespace { namespace name { constexpr const auto password{"password"}; @@ -63,10 +57,10 @@ post_login_password(client &client, // Build a canonical MXID from a the user field const m::id::user::buf user_id { - unquote(at(request)), home_server + unquote(at(request)), my_host() }; - if(!user_id.valid() || user_id.host() != home_server) + if(!user_id.valid() || user_id.host() != my_host()) throw m::error { http::FORBIDDEN, "M_FORBIDDEN", "Access denied." @@ -113,8 +107,8 @@ post_login_password(client &client, { "state_key", access_token }, { "content", json::members { - { "ip", string(remote_addr(client)) }, - { "device", "unknown" }, + { "ip", string(remote(client)) }, + { "device", "unknown" }, }} }); @@ -124,7 +118,7 @@ post_login_password(client &client, client, { { "user_id", user_id }, - { "home_server", home_server }, + { "home_server", my_host() }, { "access_token", access_token }, } }; diff --git a/modules/client/register.cc b/modules/client/register.cc index 437602837..f678159d7 100644 --- a/modules/client/register.cc +++ b/modules/client/register.cc @@ -21,12 +21,6 @@ using namespace ircd; -const auto home_server -{ - // "The hostname of the homeserver on which the account has been registered." - "cdc.z" -}; - namespace { namespace name { constexpr const auto username {"username"}; @@ -85,7 +79,7 @@ handle_post_kind_user(client &client, // specified. TODO: isn't that guest reg? const m::id::user::buf user_id { - username, home_server + username, my_host() }; // Check if the the user_id is acceptably formed for this server or throws @@ -132,7 +126,7 @@ handle_post_kind_user(client &client, client, http::CREATED, { { "user_id", user_id }, - { "home_server", home_server }, + { "home_server", my_host() }, // { "access_token", access_token }, } }; @@ -144,7 +138,7 @@ handle_post_kind_guest(client &client, { const m::id::user::buf user_id { - m::generate, home_server + m::generate, my_host() }; return resource::response @@ -152,7 +146,7 @@ handle_post_kind_guest(client &client, client, http::CREATED, { { "user_id", user_id }, - { "home_server", home_server }, + { "home_server", my_host() }, // { "access_token", access_token }, } }; @@ -204,10 +198,10 @@ validate_user_id(const m::id::user &user_id) "M_INVALID_USERNAME", "The desired user ID is not a valid user name." }; - if(user_id.host() != home_server) + if(user_id.host() != my_host()) throw m::error { - "M_INVALID_USERNAME", "Can only register with host '%s'", home_server + "M_INVALID_USERNAME", "Can only register with host '%s'", my_host() }; }