mirror of
https://github.com/element-hq/synapse
synced 2024-08-20 12:00:21 +00:00
Unbind 3pids when they're deleted too
This commit is contained in:
parent
2c7866d664
commit
b3bff53178
2 changed files with 18 additions and 3 deletions
|
@ -825,6 +825,14 @@ class AuthHandler(BaseHandler):
|
||||||
if medium == 'email':
|
if medium == 'email':
|
||||||
address = address.lower()
|
address = address.lower()
|
||||||
|
|
||||||
|
identity_handler = self.hs.get_handlers().identity_handler
|
||||||
|
identity_handler.unbind_threepid(user_id,
|
||||||
|
{
|
||||||
|
'medium': medium,
|
||||||
|
'address': address,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
ret = yield self.store.user_delete_threepid(
|
ret = yield self.store.user_delete_threepid(
|
||||||
user_id, medium, address,
|
user_id, medium, address,
|
||||||
)
|
)
|
||||||
|
|
|
@ -381,9 +381,16 @@ class ThreepidDeleteRestServlet(RestServlet):
|
||||||
requester = yield self.auth.get_user_by_req(request)
|
requester = yield self.auth.get_user_by_req(request)
|
||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
|
|
||||||
yield self.auth_handler.delete_threepid(
|
try:
|
||||||
user_id, body['medium'], body['address']
|
yield self.auth_handler.delete_threepid(
|
||||||
)
|
user_id, body['medium'], body['address']
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
# NB. This endpoint should succeed if there is nothing to
|
||||||
|
# delete, so it should only throw if something is wrong
|
||||||
|
# that we ought to care about.
|
||||||
|
logger.exception("Failed to remove threepid")
|
||||||
|
raise SynapseError(500, "Failed to remove threepid")
|
||||||
|
|
||||||
defer.returnValue((200, {}))
|
defer.returnValue((200, {}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue