summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorPauRE <prodrigestivill@gmail.com>2019-07-02 11:25:37 +0200
committerRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-07-02 10:25:37 +0100
commit948488e11528dd4926de9c8b17d41ce1a8ed127a (patch)
treefc03e70aa1ae8298d0c6a29a5d44c92e3d58c6ef /synapse/rest
parentfix async/await consentresource (#5585) (diff)
downloadsynapse-948488e11528dd4926de9c8b17d41ce1a8ed127a.tar.xz
Fix JWT login with new users (#5586)
Signed-off-by: Pau Rodriguez-Estivill <prodrigestivill@gmail.com>
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/login.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py
index ede6bc8b1e..e88d2ad7bd 100644
--- a/synapse/rest/client/v1/login.py
+++ b/synapse/rest/client/v1/login.py
@@ -319,12 +319,12 @@ class LoginRestServlet(RestServlet):
             raise LoginError(401, "Invalid JWT", errcode=Codes.UNAUTHORIZED)
 
         user_id = UserID(user, self.hs.hostname).to_string()
+        device_id = login_submission.get("device_id")
+        initial_display_name = login_submission.get("initial_device_display_name")
 
         auth_handler = self.auth_handler
         registered_user_id = yield auth_handler.check_user_exists(user_id)
         if registered_user_id:
-            device_id = login_submission.get("device_id")
-            initial_display_name = login_submission.get("initial_device_display_name")
             device_id, access_token = yield self.registration_handler.register_device(
                 registered_user_id, device_id, initial_display_name
             )
@@ -338,11 +338,8 @@ class LoginRestServlet(RestServlet):
             user_id, access_token = (
                 yield self.registration_handler.register(localpart=user)
             )
-
-            device_id = login_submission.get("device_id")
-            initial_display_name = login_submission.get("initial_device_display_name")
             device_id, access_token = yield self.registration_handler.register_device(
-                registered_user_id, device_id, initial_display_name
+                user_id, device_id, initial_display_name
             )
 
             result = {