session context

This commit is contained in:
Max Peintner
2024-12-09 15:40:37 +01:00
parent 574e8de7b6
commit 275233e4e1
2 changed files with 9 additions and 2 deletions

View File

@@ -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");

View File

@@ -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);
}