From 5279e9911d85207b18ec4c2f393fc3281bf1cad5 Mon Sep 17 00:00:00 2001 From: Pau Rodriguez-Estivill Date: Tue, 2 Jul 2019 00:55:58 +0200 Subject: [PATCH 1/3] Fix JWT login with new user Signed-off-by: Pau Rodriguez-Estivill --- synapse/rest/client/v1/login.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py index ede6bc8b1eae..e88d2ad7bd8d 100644 --- a/synapse/rest/client/v1/login.py +++ b/synapse/rest/client/v1/login.py @@ -319,12 +319,12 @@ def do_jwt_login(self, login_submission): 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 @@ def do_jwt_login(self, login_submission): 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 = { From 92f750604d79b6cd181bce69b52eb7a2691e4e35 Mon Sep 17 00:00:00 2001 From: Pau Rodriguez-Estivill Date: Tue, 2 Jul 2019 01:03:12 +0200 Subject: [PATCH 2/3] Added changelog Signed-off-by: Pau Rodriguez-Estivill --- changelog.d/5586.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5586.bugfix diff --git a/changelog.d/5586.bugfix b/changelog.d/5586.bugfix new file mode 100644 index 000000000000..f0be35be160b --- /dev/null +++ b/changelog.d/5586.bugfix @@ -0,0 +1 @@ +Fix JWT login with new users. From b19a6667a1d1e53e917ecd57e338218ef7ea3e4e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 2 Jul 2019 09:48:59 +0100 Subject: [PATCH 3/3] update changelog --- changelog.d/5586.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/5586.bugfix b/changelog.d/5586.bugfix index f0be35be160b..c0b1ecf81aa0 100644 --- a/changelog.d/5586.bugfix +++ b/changelog.d/5586.bugfix @@ -1 +1 @@ -Fix JWT login with new users. +Fixed m.login.jwt using unregistred user_id and added pyjwt>=1.6.4 as jwt conditional dependencies. Contributed by Pau Rodriguez-Estivill.