Dedicated error code for failed 3pid auth verification
This commit is contained in:
parent
0eb61a3d16
commit
03eb4adc6e
|
@ -39,6 +39,7 @@ class Codes(object):
|
||||||
MISSING_PARAM = "M_MISSING_PARAM",
|
MISSING_PARAM = "M_MISSING_PARAM",
|
||||||
TOO_LARGE = "M_TOO_LARGE",
|
TOO_LARGE = "M_TOO_LARGE",
|
||||||
EXCLUSIVE = "M_EXCLUSIVE"
|
EXCLUSIVE = "M_EXCLUSIVE"
|
||||||
|
THREEPID_AUTH_FAILED = "M_THREEPID_AUTH_FAILED"
|
||||||
|
|
||||||
|
|
||||||
class CodeMessageException(RuntimeError):
|
class CodeMessageException(RuntimeError):
|
||||||
|
|
|
@ -126,7 +126,9 @@ class ThreepidRestServlet(RestServlet):
|
||||||
threepid = yield self.identity_handler.threepid_from_creds(threePidCreds)
|
threepid = yield self.identity_handler.threepid_from_creds(threePidCreds)
|
||||||
|
|
||||||
if not threepid:
|
if not threepid:
|
||||||
raise SynapseError(400, "Failed to auth 3pid")
|
raise SynapseError(
|
||||||
|
400, "Failed to auth 3pid", Codes.THREEPID_AUTH_FAILED
|
||||||
|
)
|
||||||
|
|
||||||
for reqd in ['medium', 'address', 'validatedAt']:
|
for reqd in ['medium', 'address', 'validatedAt']:
|
||||||
if reqd not in threepid:
|
if reqd not in threepid:
|
||||||
|
|
Loading…
Reference in New Issue