mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 14:33:50 +01:00
Merge pull request #3789 from matrix-org/neilj/improve_threepid_error_strings
improve human readable error messages
This commit is contained in:
commit
a6cf7d9d9a
3 changed files with 22 additions and 7 deletions
1
changelog.d/3789.misc
Normal file
1
changelog.d/3789.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Improve human readable error messages for threepid registration/account update
|
|
@ -53,7 +53,9 @@ class EmailPasswordRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "email", body['email']):
|
if not check_3pid_allowed(self.hs, "email", body['email']):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Your email domain is not authorized on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
||||||
|
@ -89,7 +91,9 @@ class MsisdnPasswordRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Account phone numbers are not authorized on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.datastore.get_user_id_by_threepid(
|
existingUid = yield self.datastore.get_user_id_by_threepid(
|
||||||
|
@ -241,7 +245,9 @@ class EmailThreepidRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "email", body['email']):
|
if not check_3pid_allowed(self.hs, "email", body['email']):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Your email domain is not authorized on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.datastore.get_user_id_by_threepid(
|
existingUid = yield self.datastore.get_user_id_by_threepid(
|
||||||
|
@ -276,7 +282,9 @@ class MsisdnThreepidRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Account phone numbers are not authorized on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.datastore.get_user_id_by_threepid(
|
existingUid = yield self.datastore.get_user_id_by_threepid(
|
||||||
|
|
|
@ -75,7 +75,9 @@ class EmailRegisterRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "email", body['email']):
|
if not check_3pid_allowed(self.hs, "email", body['email']):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Your email domain is not authorized to register on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
||||||
|
@ -115,7 +117,9 @@ class MsisdnRegisterRequestTokenRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
if not check_3pid_allowed(self.hs, "msisdn", msisdn):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed", Codes.THREEPID_DENIED,
|
403,
|
||||||
|
"Phone numbers are not authorized to register on this server",
|
||||||
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
|
||||||
|
@ -373,7 +377,9 @@ class RegisterRestServlet(RestServlet):
|
||||||
|
|
||||||
if not check_3pid_allowed(self.hs, medium, address):
|
if not check_3pid_allowed(self.hs, medium, address):
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
403, "Third party identifier is not allowed",
|
403,
|
||||||
|
"Third party identifiers (email/phone numbers)" +
|
||||||
|
" are not authorized on this server",
|
||||||
Codes.THREEPID_DENIED,
|
Codes.THREEPID_DENIED,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue