Skip to content

Commit

Permalink
session context
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Dec 9, 2024
1 parent 574e8de commit 275233e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/login/src/app/(login)/otp/[method]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 2 additions & 0 deletions apps/login/src/components/login-otp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -206,6 +207,7 @@ export function LoginOTP({
)
: null;

setLoading(false);
if (url) {
router.push(url);
}
Expand Down

0 comments on commit 275233e

Please sign in to comment.