mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 17:23:50 +01:00
Remove threepid binding if id server returns 400/404/501
This commit is contained in:
parent
c75e2017f1
commit
24232514bf
1 changed files with 10 additions and 9 deletions
|
@ -227,23 +227,24 @@ class IdentityHandler(BaseHandler):
|
||||||
content,
|
content,
|
||||||
headers,
|
headers,
|
||||||
)
|
)
|
||||||
|
changed = True
|
||||||
yield self.store.remove_user_bound_threepid(
|
|
||||||
user_id=mxid,
|
|
||||||
medium=threepid["medium"],
|
|
||||||
address=threepid["address"],
|
|
||||||
id_server=id_server,
|
|
||||||
)
|
|
||||||
except HttpResponseException as e:
|
except HttpResponseException as e:
|
||||||
|
changed = False
|
||||||
if e.code in (400, 404, 501,):
|
if e.code in (400, 404, 501,):
|
||||||
# The remote server probably doesn't support unbinding (yet)
|
# The remote server probably doesn't support unbinding (yet)
|
||||||
logger.warn("Received %d response while unbinding threepid", e.code)
|
logger.warn("Received %d response while unbinding threepid", e.code)
|
||||||
defer.returnValue(False)
|
|
||||||
else:
|
else:
|
||||||
logger.error("Failed to unbind threepid on identity server: %s", e)
|
logger.error("Failed to unbind threepid on identity server: %s", e)
|
||||||
raise SynapseError(502, "Failed to contact identity server")
|
raise SynapseError(502, "Failed to contact identity server")
|
||||||
|
|
||||||
defer.returnValue(True)
|
yield self.store.remove_user_bound_threepid(
|
||||||
|
user_id=mxid,
|
||||||
|
medium=threepid["medium"],
|
||||||
|
address=threepid["address"],
|
||||||
|
id_server=id_server,
|
||||||
|
)
|
||||||
|
|
||||||
|
defer.returnValue(changed)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def requestEmailToken(self, id_server, email, client_secret, send_attempt, **kwargs):
|
def requestEmailToken(self, id_server, email, client_secret, send_attempt, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue