diff --git a/apps/login/src/app/(login)/otp/[method]/page.tsx b/apps/login/src/app/(login)/otp/[method]/page.tsx index 1c0904ce..64b7c9ed 100644 --- a/apps/login/src/app/(login)/otp/[method]/page.tsx +++ b/apps/login/src/app/(login)/otp/[method]/page.tsx @@ -27,9 +27,14 @@ export default async function Page(props: { organization, }); - const branding = await getBrandingSettings(organization); + // email links do not come with organization, thus we need to use the session's organization + const branding = await getBrandingSettings( + organization ?? session?.factors?.user?.organizationId, + ); - const loginSettings = await getLoginSettings(organization); + const loginSettings = await getLoginSettings( + organization ?? session?.factors?.user?.organizationId, + ); const host = (await headers()).get("host"); diff --git a/apps/login/src/components/login-otp.tsx b/apps/login/src/components/login-otp.tsx index d63f4f91..1c867265 100644 --- a/apps/login/src/components/login-otp.tsx +++ b/apps/login/src/components/login-otp.tsx @@ -182,6 +182,7 @@ export function LoginOTP({ function setCodeAndContinue(values: Inputs, organization?: string) { return submitCode(values, organization).then(async (response) => { + setLoading(true); // Wait for 2 seconds to avoid eventual consistency issues with an OTP code being verified in the /login endpoint await new Promise((resolve) => setTimeout(resolve, 4000)); @@ -206,6 +207,7 @@ export function LoginOTP({ ) : null; + setLoading(false); if (url) { router.push(url); }