Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Apply logging from hotfixes branch to develop
Browse files Browse the repository at this point in the history
Part of #4826.

Originally added in #11882.
  • Loading branch information
David Robertson committed Feb 10, 2023
1 parent 14be78d commit 6d9779c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions synapse/rest/client/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
request, MsisdnRequestTokenBody
)
msisdn = phone_number_to_msisdn(body.country, body.phone_number)
logger.info("Request #%s to verify ownership of %s", body.send_attempt, msisdn)

if not await check_3pid_allowed(self.hs, "msisdn", msisdn):
raise SynapseError(
Expand Down Expand Up @@ -444,6 +445,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await self.hs.get_clock().sleep(random.randint(1, 10) / 10)
return 200, {"sid": random_string(16)}

logger.info("MSISDN %s is already in use by %s", msisdn, existing_user_id)
raise SynapseError(400, "MSISDN is already in use", Codes.THREEPID_IN_USE)

if not self.hs.config.registration.account_threepid_delegate_msisdn:
Expand All @@ -468,6 +470,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
threepid_send_requests.labels(type="msisdn", reason="add_threepid").observe(
body.send_attempt
)
logger.info("MSISDN %s: got response from identity server: %s", msisdn, ret)

return 200, ret

Expand Down

0 comments on commit 6d9779c

Please sign in to comment.