Dedicated error code for failed 3pid auth verification

This commit is contained in:
David Baker 2015-04-23 18:20:17 +01:00
parent 0eb61a3d16
commit 03eb4adc6e
2 changed files with 4 additions and 1 deletions

View File

@ -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):

View File

@ -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: