0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-10 04:28:35 +02:00

modules/client/login: Set device in user's room on login.

This commit is contained in:
Jason Volk 2019-02-18 16:42:08 -08:00
parent d33b3911b1
commit aed1c856ef

View file

@ -86,10 +86,20 @@ post__login_password(client &client,
// access_token will be committed and the user will be logged in.
m::send(m::user::tokens, user_id, "ircd.access_token", access_token,
{
{ "ip", string(remote(client)) },
{ "device", device_id },
{ "ip", string(remote(client)) },
{ "device_id", device_id },
});
const m::user::room user_room{user};
if(!user_room.has("ircd.device", device_id))
m::send(user_room, user_id, "ircd.device", device_id, json::members
{
{ "device_id", device_id },
{ "display_name", initial_device_display_name },
{ "last_seen_ts", ircd::time<milliseconds>() },
{ "last_seen_ip", string(remote(client)) },
});
// Send response to user
return resource::response
{