summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-08-12 15:44:08 +0100
committerDavid Baker <dave@matrix.org>2015-08-12 15:44:08 +0100
commitf43041aacd36b7d9052476bcb0d083ea4213a9f9 (patch)
tree2cacacd3aaf699381bdbf8e280c24c65445e2c7f /synapse/rest
parentJust leaving off the $ is fine. r* == registerrrrrrrrr (diff)
downloadsynapse-f43041aacd36b7d9052476bcb0d083ea4213a9f9.tar.xz
Check absent before trying to access keys
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/register.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index e6ad35aa16..254c5f1ddf 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -224,6 +224,9 @@ class RegisterRestServlet(RestServlet):
             if k not in body:
                 absent.append(k)
 
+        if len(absent) > 0:
+            raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
+
         existingUid = yield self.hs.get_datastore().get_user_id_by_threepid(
             'email', body['email']
         )
@@ -231,9 +234,6 @@ class RegisterRestServlet(RestServlet):
         if existingUid is not None:
             raise SynapseError(400, "Email is already in use", Codes.THREEPID_IN_USE)
 
-        if len(absent) > 0:
-            raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
-
         ret = yield self.identity_handler.requestEmailToken(**body)
         defer.returnValue((200, ret))