From aa6a5971910f9963467d3f73def783c7e072cd53 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Fri, 27 Dec 2024 11:48:11 +0100 Subject: [PATCH] fix: ordering of conditions --- .../src/app/(login)/idp/[provider]/success/page.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/login/src/app/(login)/idp/[provider]/success/page.tsx b/apps/login/src/app/(login)/idp/[provider]/success/page.tsx index 3049ce835c..d84f5ac55e 100644 --- a/apps/login/src/app/(login)/idp/[provider]/success/page.tsx +++ b/apps/login/src/app/(login)/idp/[provider]/success/page.tsx @@ -153,8 +153,11 @@ export default async function Page(props: { } } - // if link === true, do not create user - if (options?.isCreationAllowed && options.isAutoCreation && !link) { + if (link) { + return linkingFailed(branding); + } + + if (options?.isCreationAllowed && options.isAutoCreation) { let orgToRegisterOn: string | undefined = organization; let userData: AddHumanUserRequest = @@ -209,10 +212,6 @@ export default async function Page(props: { } } - if (link) { - return linkingFailed(branding); - } - // return login failed if no linking or creation is allowed and no user was found return loginFailed(branding, "No user found"); }