This commit is contained in:
David Baker 2018-05-24 11:23:15 +01:00
parent a21a41bad7
commit 9700d15611
4 changed files with 13 additions and 8 deletions

View file

@ -826,7 +826,8 @@ class AuthHandler(BaseHandler):
address = address.lower() address = address.lower()
identity_handler = self.hs.get_handlers().identity_handler identity_handler = self.hs.get_handlers().identity_handler
identity_handler.unbind_threepid(user_id, identity_handler.unbind_threepid(
user_id,
{ {
'medium': medium, 'medium': medium,
'address': address, 'address': address,

View file

@ -60,17 +60,20 @@ class DeactivateAccountHandler(BaseHandler):
threepids = yield self.store.user_get_threepids(user_id) threepids = yield self.store.user_get_threepids(user_id)
for threepid in threepids: for threepid in threepids:
try: try:
yield self._identity_handler.unbind_threepid(user_id, yield self._identity_handler.unbind_threepid(
user_id,
{ {
'medium': threepid['medium'], 'medium': threepid['medium'],
'address': threepid['address'], 'address': threepid['address'],
}, },
) )
except: except Exception:
# Do we want this to be a fatal error or should we carry on? # Do we want this to be a fatal error or should we carry on?
logger.exception("Failed to remove threepid from ID server") logger.exception("Failed to remove threepid from ID server")
raise SynapseError(400, "Failed to remove threepid from ID server") raise SynapseError(400, "Failed to remove threepid from ID server")
yield self.store.user_delete_threepid(user_id, threepid['medium'], threepid['address']) yield self.store.user_delete_threepid(
user_id, threepid['medium'], threepid['address'],
)
# first delete any devices belonging to the user, which will also # first delete any devices belonging to the user, which will also
# delete corresponding access tokens. # delete corresponding access tokens.

View file

@ -148,9 +148,10 @@ class IdentityHandler(BaseHandler):
logger.warn("Can't unbind threepid: no trusted ID servers set in config") logger.warn("Can't unbind threepid: no trusted ID servers set in config")
defer.returnValue(False) defer.returnValue(False)
# We don't track what ID server we added 3pids on (perhaps we ought to) but we assume # We don't track what ID server we added 3pids on (perhaps we ought to)
# that any of the servers in the trusted list are in the same ID server federation, # but we assume that any of the servers in the trusted list are in the
# so we can pick any one of them to send the deletion request to. # same ID server federation, so we can pick any one of them to send the
# deletion request to.
id_server = next(iter(self.trusted_id_servers)) id_server = next(iter(self.trusted_id_servers))
url = "https://%s/_matrix/identity/api/v1/3pid/unbind" % (id_server,) url = "https://%s/_matrix/identity/api/v1/3pid/unbind" % (id_server,)

View file

@ -385,7 +385,7 @@ class ThreepidDeleteRestServlet(RestServlet):
yield self.auth_handler.delete_threepid( yield self.auth_handler.delete_threepid(
user_id, body['medium'], body['address'] user_id, body['medium'], body['address']
) )
except Exception as e: except Exception:
# NB. This endpoint should succeed if there is nothing to # NB. This endpoint should succeed if there is nothing to
# delete, so it should only throw if something is wrong # delete, so it should only throw if something is wrong
# that we ought to care about. # that we ought to care about.