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

index 12a7cace55..2c4991c6e5 100644 --- a/synapse/handlers/deactivate_account.py +++ b/synapse/handlers/deactivate_account.py
@@ -43,7 +43,6 @@ class DeactivateAccountHandler: self._auth_handler = hs.get_auth_handler() self._device_handler = hs.get_device_handler() self._room_member_handler = hs.get_room_member_handler() - self._identity_handler = hs.get_identity_handler() self._profile_handler = hs.get_profile_handler() self.user_directory_handler = hs.get_user_directory_handler() self._server_name = hs.hostname @@ -82,7 +81,7 @@ class DeactivateAccountHandler: by_admin: Whether this change was made by an administrator. Returns: - True if identity server supports removing threepids, otherwise False. + True """ # This can only be called on the main process. @@ -96,40 +95,6 @@ class DeactivateAccountHandler: 403, "Deactivation of this user is forbidden", Codes.FORBIDDEN ) - # FIXME: Theoretically there is a race here wherein user resets - # password using threepid. - - # delete threepids first. We remove these from the IS so if this fails, - # leave the user still active so they can try again. - # Ideally we would prevent password resets and then do this in the - # background thread. - - # This will be set to false if the identity server doesn't support - # unbinding - identity_server_supports_unbinding = True - - # Attempt to unbind any known bound threepids to this account from identity - # server(s). - bound_threepids = await self.store.user_get_bound_threepids(user_id) - for medium, address in bound_threepids: - try: - result = await self._identity_handler.try_unbind_threepid( - user_id, medium, address, id_server - ) - except Exception: - # Do we want this to be a fatal error or should we carry on? - logger.exception("Failed to remove threepid from ID server") - raise SynapseError(400, "Failed to remove threepid from ID server") - - identity_server_supports_unbinding &= result - - # Remove any local threepid associations for this account. - local_threepids = await self.store.user_get_threepids(user_id) - for local_threepid in local_threepids: - await self._auth_handler.delete_local_threepid( - user_id, local_threepid.medium, local_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) @@ -194,7 +159,7 @@ class DeactivateAccountHandler: by_admin, ) - return identity_server_supports_unbinding + return True async def _reject_pending_invites_and_knocks_for_user(self, user_id: str) -> None: """Reject pending invites and knocks addressed to a given user ID.