From f7ab99a77f2996389c0b7de28d763ce454689791 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 5 Mar 2021 10:17:32 +0000 Subject: [PATCH] Check correct auth type field --- clientapi/routing/register.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index cd19dec97..7d5ddbea9 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -502,7 +502,7 @@ func Register( // Squash username to all lowercase letters r.Username = strings.ToLower(r.Username) - if r.Auth.Type == authtypes.LoginTypeApplicationService { + if r.Type == authtypes.LoginTypeApplicationService && accessTokenErr == nil { if resErr = validateApplicationServiceUsername(r.Username); resErr != nil { return *resErr } @@ -604,7 +604,7 @@ func handleRegistrationFlow( // registration or user exclusivity. We'll go onto the appservice // registration flow if a valid access token was provided or if // the login type specifically requests it. - if r.Auth.Type == authtypes.LoginTypeApplicationService { + if r.Type == authtypes.LoginTypeApplicationService && accessTokenErr == nil { return handleApplicationServiceRegistration( accessToken, accessTokenErr, req, r, cfg, userAPI, )