summary refs log tree commit diff
path: root/synapse/handlers/deactivate_account.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers/deactivate_account.py')
-rw-r--r--synapse/handlers/deactivate_account.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py

index a10b89ec30..bb8eb1a8dc 100644 --- a/synapse/handlers/deactivate_account.py +++ b/synapse/handlers/deactivate_account.py
@@ -100,13 +100,17 @@ class DeactivateAccountHandler: # unbinding identity_server_supports_unbinding = True - # Remove any threepids associated with this account locally and attempt to - # unbind them from identity server(s). - threepids = await self.store.user_get_threepids(user_id) - for threepid in threepids: + # Delete any known bindings of this user's 3PIDs on identity servers. + bound_threepids = await self.store.user_get_bound_threepids(user_id) + for threepid in bound_threepids: try: - result = await self._auth_handler.delete_and_unbind_threepid( - user_id, threepid["medium"], threepid["address"], id_server + result = await self.hs.get_identity_handler().try_unbind_threepid( + user_id, + { + "medium": threepid["medium"], + "address": threepid["address"], + "id_server": id_server, + }, ) except Exception: # Do we want this to be a fatal error or should we carry on? @@ -115,6 +119,13 @@ class DeactivateAccountHandler: identity_server_supports_unbinding &= result + # Delete all threepids associated with this account. + local_threepids = await self.store.user_get_threepids(user_id) + for threepid in local_threepids: + await self._auth_handler.delete_local_threepid( + user_id, threepid["medium"], threepid["address"] + ) + # delete any devices belonging to the user, which will also # delete corresponding access tokens. await self._device_handler.delete_all_devices_for_user(user_id)