diff --git a/apps/login/src/app/(login)/verify/page.tsx b/apps/login/src/app/(login)/verify/page.tsx index 09723e97062..43adf229688 100644 --- a/apps/login/src/app/(login)/verify/page.tsx +++ b/apps/login/src/app/(login)/verify/page.tsx @@ -1,8 +1,6 @@ -import { Alert } from "@/components/alert"; import { DynamicTheme } from "@/components/dynamic-theme"; import { VerifyEmailForm } from "@/components/verify-email-form"; import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel"; -import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { getLocale, getTranslations } from "next-intl/server"; export default async function Page({ searchParams }: { searchParams: any }) { @@ -27,32 +25,16 @@ export default async function Page({ searchParams }: { searchParams: any }) { return (
-

{t("title")}

-

{t("description")}

- - {!userId && ( -
- {tError("unknownContext")} -
- )} - - {userId ? ( - - ) : ( -
- - {t("userIdMissing")} -
- )} +
); diff --git a/apps/login/src/components/verify-email-form.tsx b/apps/login/src/components/verify-email-form.tsx index 7f8d6dcc068..31540b445be 100644 --- a/apps/login/src/components/verify-email-form.tsx +++ b/apps/login/src/components/verify-email-form.tsx @@ -18,7 +18,7 @@ type Inputs = { }; type Props = { - userId: string; + userId?: string; loginName: string; code: string; organization?: string; @@ -39,6 +39,7 @@ export function VerifyEmailForm({ isInvite, }: Props) { const t = useTranslations("verify"); + const tError = useTranslations("error"); const { register, handleSubmit, formState } = useForm({ mode: "onBlur", @@ -65,9 +66,11 @@ export function VerifyEmailForm({ const router = useRouter(); - const params = new URLSearchParams({ - userId: userId, - }); + const params = new URLSearchParams({}); + + if (userId) { + params.append("userId", userId); + } if (isInvite) { params.append("initial", "true"); @@ -128,10 +131,13 @@ export function VerifyEmailForm({ // if auth methods fall trough, we complete to login const params = new URLSearchParams({ - userId: userId, initial: "true", // defines that a code is not required and is therefore not shown in the UI }); + if (userId) { + params.set("userId", userId); + } + if (organization) { params.set("organization", organization); } @@ -146,50 +152,66 @@ export function VerifyEmailForm({ } return !authMethods ? ( -
-
- -
+ <> +

{t("title")}

+

{t("description")}

- {error && ( + {!userId && (
- {error} + {tError("unknownContext")}
)} -
- - - -
-
+
+
+ +
+ + {error && ( +
+ {error} +
+ )} + +
+ + + +
+
+ ) : ( -
- {!authMethods.includes(AuthenticationMethodType.PASSWORD) && - PASSWORD(false, "/password/set?" + params)} - {!authMethods.includes(AuthenticationMethodType.PASSKEY) && - PASSKEYS(false, "/passkeys/set?" + params)} -
+ <> +

{t("title")}

+

{t("description")}

+ +
+ {!authMethods.includes(AuthenticationMethodType.PASSWORD) && + PASSWORD(false, "/password/set?" + params)} + {!authMethods.includes(AuthenticationMethodType.PASSKEY) && + PASSKEYS(false, "/passkeys/set?" + params)} +
+ ); }