summary refs log tree commit diff
diff options
context:
space:
mode:
authorKegsay <kegsay@gmail.com>2016-04-14 15:08:54 +0100
committerKegsay <kegsay@gmail.com>2016-04-14 15:08:54 +0100
commit4802f9cdb6efd5d5e7ebb9f2b8c0cad12bd79bc1 (patch)
treefab5263424cfed20b86edaeb1a3b560549cf5b21
parentcomment out 2c838f6459db35ad9812a83184d85a06ca5d940a due to risk of https://e... (diff)
parentMake v2_alpha reg follow the AS API specification (diff)
downloadsynapse-4802f9cdb6efd5d5e7ebb9f2b8c0cad12bd79bc1.tar.xz
Merge pull request #727 from matrix-org/kegan/fix-asapi-reg
Make v2_alpha reg follow the AS API specification
-rw-r--r--synapse/rest/client/v2_alpha/register.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index d32c06c882..ff8f69ddbf 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -100,6 +100,11 @@ class RegisterRestServlet(RestServlet):
 
         # == Application Service Registration ==
         if appservice:
+            # Set the desired user according to the AS API (which uses the
+            # 'user' key not 'username'). Since this is a new addition, we'll
+            # fallback to 'username' if they gave one.
+            if isinstance(body.get("user"), basestring):
+                desired_username = body["user"]
             result = yield self._do_appservice_registration(
                 desired_username, request.args["access_token"][0]
             )