From 1beabed8cf682cf39caf77c4b28d460927c54b84 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Fri, 3 Jul 2026 16:25:20 +0200 Subject: [PATCH] fix(login): preserve org domain suffix through account chooser navigation (#12304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #12024 # Which Problems Are Solved When the login flow is started with an `urn:zitadel:iam:org:domain:primary:{domain}` scope, the resolved domain suffix is lost if the user navigates through the account chooser (e.g. clicking "Use another account"). This causes the login to fail with "User not found" because the organization can no longer be resolved. Additionally, the `hideLoginNameSuffix` branding setting was never respected by the login app. # How the Problems Are Solved - Forward the `orgDomain` parameter through `gotoAccounts()` and the `/accounts` page, so it survives navigation to `/loginname` — the same way `organization` and `requestId` are already forwarded. - Respect `BrandingSettings.hideLoginNameSuffix`: when enabled, the `@domain.com` suffix is hidden from the input UI but still used internally for user search. --------- Co-authored-by: Livio Spring <9405495+livio-a@users.noreply.github.com> --- apps/login/src/app/(login)/accounts/page.tsx | 5 +++ apps/login/src/app/(login)/loginname/page.tsx | 5 ++- apps/login/src/components/username-form.tsx | 4 +- apps/login/src/lib/server/flow-initiation.ts | 42 ++++++++++++------- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/apps/login/src/app/(login)/accounts/page.tsx b/apps/login/src/app/(login)/accounts/page.tsx index edae804e0..475e8e5bd 100644 --- a/apps/login/src/app/(login)/accounts/page.tsx +++ b/apps/login/src/app/(login)/accounts/page.tsx @@ -43,6 +43,7 @@ export default async function Page(props: { searchParams: Promise
diff --git a/apps/login/src/app/(login)/loginname/page.tsx b/apps/login/src/app/(login)/loginname/page.tsx index a656d0860..1cf4960a2 100644 --- a/apps/login/src/app/(login)/loginname/page.tsx +++ b/apps/login/src/app/(login)/loginname/page.tsx @@ -20,7 +20,7 @@ export default async function Page(props: { searchParams: Promise diff --git a/apps/login/src/components/username-form.tsx b/apps/login/src/components/username-form.tsx index e2adbda15..f73aa3342 100644 --- a/apps/login/src/components/username-form.tsx +++ b/apps/login/src/components/username-form.tsx @@ -26,6 +26,7 @@ type Props = { organization?: string; defaultOrganization?: string; suffix?: string; + hideSuffix?: boolean; submit: boolean; allowRegister: boolean; }; @@ -36,6 +37,7 @@ export function UsernameForm({ organization, defaultOrganization, suffix, + hideSuffix, loginSettings, submit, allowRegister, @@ -111,7 +113,7 @@ export function UsernameForm({ {...register("loginName", { required: t("required.loginName") })} label={inputLabel} data-testid="username-text-input" - suffix={suffix} + suffix={hideSuffix ? undefined : suffix} /> {allowRegister && (