summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-18 17:54:14 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-18 17:54:14 +0000
commit8b47cb8352852ed37fb9d4249ca913287b685932 (patch)
treedf0509a49aee6603c57ff156132fc8caf64fdd57
parentClarifications for the email configuration settings. (#6423) (diff)
parentRemove local threepids on account deactivation (#6426) (diff)
downloadsynapse-8b47cb8352852ed37fb9d4249ca913287b685932.tar.xz
Remove local threepids on account deactivation (#6426)
* commit 'a9c44d400':
  Remove local threepids on account deactivation (#6426)
-rw-r--r--changelog.d/6426.bugfix1
-rw-r--r--synapse/handlers/deactivate_account.py3
-rw-r--r--synapse/storage/data_stores/main/registration.py13
3 files changed, 17 insertions, 0 deletions
diff --git a/changelog.d/6426.bugfix b/changelog.d/6426.bugfix
new file mode 100644

index 0000000000..3acfde4211 --- /dev/null +++ b/changelog.d/6426.bugfix
@@ -0,0 +1 @@ +Clean up local threepids from user on account deactivation. \ No newline at end of file diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py
index 7c5378c423..09bf76038e 100644 --- a/synapse/handlers/deactivate_account.py +++ b/synapse/handlers/deactivate_account.py
@@ -96,6 +96,9 @@ class DeactivateAccountHandler(BaseHandler): user_id, threepid["medium"], threepid["address"] ) + # Remove all 3PIDs this user has bound to the homeserver + yield self.store.user_delete_threepids(user_id) + # delete any devices belonging to the user, which will also # delete corresponding access tokens. yield self._device_handler.delete_all_devices_for_user(user_id) diff --git a/synapse/storage/data_stores/main/registration.py b/synapse/storage/data_stores/main/registration.py
index 14fd9af4ee..cda6b5034b 100644 --- a/synapse/storage/data_stores/main/registration.py +++ b/synapse/storage/data_stores/main/registration.py
@@ -591,6 +591,19 @@ class RegistrationWorkerStore(SQLBaseStore): return self._simple_delete( "user_threepids", keyvalues={"user_id": user_id, "medium": medium, "address": address}, + desc="user_delete_threepid", + ) + + def user_delete_threepids(self, user_id: str): + """Delete all threepid this user has bound + + Args: + user_id: The user id to delete all threepids of + + """ + return self._simple_delete( + "user_threepids", + keyvalues={"user_id": user_id}, desc="user_delete_threepids", )