From d8c58504c5e120615783f92cf0d89ca8b052659d Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 28 Aug 2019 08:30:06 +0100 Subject: [PATCH] Pull user_type from the request --- maubot/management/api/client_auth.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/maubot/management/api/client_auth.py b/maubot/management/api/client_auth.py index 2d43106..cf4d845 100644 --- a/maubot/management/api/client_auth.py +++ b/maubot/management/api/client_auth.py @@ -74,7 +74,8 @@ async def read_client_auth_request(request: web.Request) -> Tuple[Optional[AuthR except KeyError: return None, resp.invalid_server api = HTTPAPI(base_url, "", loop=get_loop()) - return (api, secret, username, password), None + user_type = body.get("user_type", None) + return (api, secret, username, password, user_type), None @routes.post("/client/auth/{server}/register") @@ -82,7 +83,7 @@ async def register(request: web.Request) -> web.Response: info, err = await read_client_auth_request(request) if err is not None: return err - api, secret, username, password = info + api, secret, username, password, user_type = info res = await api.request(Method.GET, Path.admin.register) nonce = res["nonce"] mac = generate_mac(secret, nonce, username, password) @@ -93,7 +94,8 @@ async def register(request: web.Request) -> web.Response: "password": password, "admin": False, "mac": mac, - "user_type": "bot", + # Older versions of synapse will ignore this field if it is None + "user_type": user_type, })) except MatrixRequestError as e: return web.json_response({