summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Hunt <half-shot@molrams.com>2016-07-16 15:40:21 +0100
committerWill Hunt <half-shot@molrams.com>2016-07-16 18:33:48 +0100
commite885e2a623b6a5803b43023978b843c2002bc677 (patch)
treec2369299adfe7d025a6eac0f0e10a3568bda28d2
parentMerge pull request #923 from matrix-org/erikj/purge_history (diff)
downloadsynapse-e885e2a623b6a5803b43023978b843c2002bc677.tar.xz
Fall back to 'username' if 'user' is not given for appservice reg.
-rw-r--r--synapse/rest/client/v2_alpha/register.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index 7c6d2942dc..8da73a8615 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -134,9 +134,11 @@ class RegisterRestServlet(RestServlet):
             # 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]
-            )
+
+            if isinstance(desired_username, basestring):
+                result = yield self._do_appservice_registration(
+                    desired_username, request.args["access_token"][0]
+                )
             defer.returnValue((200, result))  # we throw for non 200 responses
             return