From 544722bad23fc31056b9240189c3cbbbf0ffd3f9 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 18 Nov 2016 17:07:35 +0000 Subject: [PATCH 1/2] Work around client replacing reg params Works around https://github.com/vector-im/vector-android/issues/715 and equivalent for iOS --- synapse/rest/client/v2_alpha/register.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index 68d18a9b82..b20d9a1095 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -169,6 +169,18 @@ class RegisterRestServlet(RestServlet): guest_access_token = body.get("guest_access_token", None) + if ( + 'initial_device_display_name' in body and + 'password' not in body + ): + # ignore 'initial_device_display_name' if sent without + # a password to work around a client bug where it sent + # the 'initial_device_display_name' param alone, wiping out + # the original registration params + logger.warn("Ignoring initial_device_display_name without password") + del body['initial_device_display_name'] + + session_id = self.auth_handler.get_session_id(body) registered_user_id = None if session_id: From a2891509439d2ec6d12bcc348293e3e9162cd0df Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 18 Nov 2016 17:15:02 +0000 Subject: [PATCH 2/2] Fix flake8 --- synapse/rest/client/v2_alpha/register.py | 1 - 1 file changed, 1 deletion(-) diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index b20d9a1095..6cfb20866b 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -180,7 +180,6 @@ class RegisterRestServlet(RestServlet): logger.warn("Ignoring initial_device_display_name without password") del body['initial_device_display_name'] - session_id = self.auth_handler.get_session_id(body) registered_user_id = None if session_id: