summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-04-15 15:50:38 +0100
committerDavid Baker <dave@matrix.org>2015-04-15 15:50:38 +0100
commita19b73990962ff3bfe8b2cae59446bbe7f93ec5c (patch)
treeb8e7c10ad830b0b1897f66480013bb950a0e41dc /synapse/rest/client
parentAdd app service auth back in to v2 register (diff)
downloadsynapse-a19b73990962ff3bfe8b2cae59446bbe7f93ec5c.tar.xz
Regstration with email in v2
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/password.py6
-rw-r--r--synapse/rest/client/v2_alpha/register.py8
2 files changed, 7 insertions, 7 deletions
diff --git a/synapse/rest/client/v2_alpha/password.py b/synapse/rest/client/v2_alpha/password.py
index 85954c71cd..cb0c8cfb55 100644
--- a/synapse/rest/client/v2_alpha/password.py
+++ b/synapse/rest/client/v2_alpha/password.py
@@ -41,7 +41,7 @@ class PasswordRestServlet(RestServlet):
     def on_POST(self, request):
         body = parse_json_dict_from_request(request)
 
-        authed, result = yield self.auth_handler.check_auth([
+        authed, result, params = yield self.auth_handler.check_auth([
             [LoginType.PASSWORD]
         ], body)
 
@@ -61,9 +61,9 @@ class PasswordRestServlet(RestServlet):
 
         user_id = auth_user.to_string()
 
-        if 'new_password' not in body:
+        if 'new_password' not in params:
             raise SynapseError(400, "", Codes.MISSING_PARAM)
-        new_password = body['new_password']
+        new_password = params['new_password']
 
         yield self.login_handler.set_password(
             user_id, new_password, client.token_id
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index 72319a3bb2..d7a20fc964 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -74,7 +74,7 @@ class RegisterRestServlet(RestServlet):
             )
             is_using_shared_secret = True
         else:
-            authed, result = yield self.auth_handler.check_auth([
+            authed, result, params = yield self.auth_handler.check_auth([
                 [LoginType.RECAPTCHA],
                 [LoginType.EMAIL_IDENTITY, LoginType.RECAPTCHA],
             ], body, self.hs.get_ip_from_request(request))
@@ -90,10 +90,10 @@ class RegisterRestServlet(RestServlet):
         if not can_register:
             raise SynapseError(403, "Registration has been disabled")
 
-        if 'username' not in body or 'password' not in body:
+        if 'username' not in params or 'password' not in params:
             raise SynapseError(400, "", Codes.MISSING_PARAM)
-        desired_username = body['username']
-        new_password = body['password']
+        desired_username = params['username']
+        new_password = params['password']
 
         (user_id, token) = yield self.registration_handler.register(
             localpart=desired_username,