1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-07-27 12:58:53 +02:00

Merge branch 'logout-devices' into 'master'

Respect logout_devices param on password change

See merge request famedly/conduit!15
This commit is contained in:
Timo Kösters 2021-01-16 22:35:08 +00:00
commit 9424ba0559

View file

@ -572,16 +572,16 @@ pub async fn change_password_route(
db.users.set_password(&sender_user, &body.new_password)?; db.users.set_password(&sender_user, &body.new_password)?;
// TODO: Read logout_devices field when it's available and respect that, currently not supported in Ruma if body.logout_devices {
// See: https://github.com/ruma/ruma/issues/107 // Logout all devices except the current one
// Logout all devices except the current one for id in db
for id in db .users
.users .all_device_ids(&sender_user)
.all_device_ids(&sender_user) .filter_map(|id| id.ok())
.filter_map(|id| id.ok()) .filter(|id| id != sender_device)
.filter(|id| id != sender_device) {
{ db.users.remove_device(&sender_user, &id)?;
db.users.remove_device(&sender_user, &id)?; }
} }
db.flush().await?; db.flush().await?;