mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-19 12:24:23 -05:00
Fix JWT login with new users (#5586)
Signed-off-by: Pau Rodriguez-Estivill <prodrigestivill@gmail.com>
This commit is contained in:
parent
b4914681a5
commit
948488e115
1
changelog.d/5586.bugfix
Normal file
1
changelog.d/5586.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fixed m.login.jwt using unregistred user_id and added pyjwt>=1.6.4 as jwt conditional dependencies. Contributed by Pau Rodriguez-Estivill.
|
@ -319,12 +319,12 @@ class LoginRestServlet(RestServlet):
|
|||||||
raise LoginError(401, "Invalid JWT", errcode=Codes.UNAUTHORIZED)
|
raise LoginError(401, "Invalid JWT", errcode=Codes.UNAUTHORIZED)
|
||||||
|
|
||||||
user_id = UserID(user, self.hs.hostname).to_string()
|
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
|
auth_handler = self.auth_handler
|
||||||
registered_user_id = yield auth_handler.check_user_exists(user_id)
|
registered_user_id = yield auth_handler.check_user_exists(user_id)
|
||||||
if registered_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(
|
device_id, access_token = yield self.registration_handler.register_device(
|
||||||
registered_user_id, device_id, initial_display_name
|
registered_user_id, device_id, initial_display_name
|
||||||
)
|
)
|
||||||
@ -338,11 +338,8 @@ class LoginRestServlet(RestServlet):
|
|||||||
user_id, access_token = (
|
user_id, access_token = (
|
||||||
yield self.registration_handler.register(localpart=user)
|
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(
|
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 = {
|
result = {
|
||||||
|
Loading…
Reference in New Issue
Block a user