0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 00:10:59 +01:00

modules/client/devices: Revoke access tokens when devices deleted.

This commit is contained in:
Jason Volk 2023-03-03 12:13:47 -08:00
parent 694b208829
commit a1d4e448ea
2 changed files with 26 additions and 2 deletions

View file

@ -74,12 +74,26 @@ post__delete_devices(client &client,
request.user_id
};
const m::user::tokens access_tokens
{
request.user_id
};
size_t revoked(0);
for(const json::string device_id : devices)
user_devices.del(device_id);
revoked += access_tokens.del_by_device(device_id, "device deleted");
size_t deleted(0);
for(const json::string device_id : devices)
deleted += user_devices.del(device_id);
return m::resource::response
{
client, http::OK
client, json::members
{
{ "deleted", long(deleted) },
{ "revoked", long(revoked) },
}
};
}

View file

@ -193,6 +193,16 @@ delete__devices(client &client,
"Incorrect password."
};
const m::user::tokens tokens
{
request.user_id
};
const size_t revoked
{
tokens.del_by_device(device_id)
};
const m::user::devices devices
{
request.user_id