Update client_auth.py

This commit is contained in:
Will Hunt 2020-03-04 13:31:45 +00:00 committed by GitHub
parent ec58900cf2
commit c4aee0d1eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ async def read_client_auth_request(request: web.Request) -> Tuple[Optional[AuthR
except KeyError: except KeyError:
return None, resp.invalid_server return None, resp.invalid_server
api = HTTPAPI(base_url, "", loop=get_loop()) api = HTTPAPI(base_url, "", loop=get_loop())
user_type = body.get("user_type", None) user_type = body.get("user_type", "bot")
return AuthRequestInfo(api, secret, username, password, user_type), None return AuthRequestInfo(api, secret, username, password, user_type), None
@ -88,8 +88,6 @@ async def register(request: web.Request) -> web.Response:
if err is not None: if err is not None:
return err return err
api, secret, username, password, user_type = info api, secret, username, password, user_type = info
if user_type is None:
user_type = "bot"
res = await api.request(Method.GET, Path.admin.register) res = await api.request(Method.GET, Path.admin.register)
nonce = res["nonce"] nonce = res["nonce"]
mac = generate_mac(secret, nonce, username, password, user_type) mac = generate_mac(secret, nonce, username, password, user_type)