fix error handler, skip send

This commit is contained in:
Max Peintner
2024-12-24 09:50:40 +01:00
parent 53fc22e048
commit 807f01f5b5
4 changed files with 12 additions and 0 deletions

View File

@@ -47,6 +47,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
await resendVerification({
userId: sessionFactors?.factors?.user?.id,
isInvite: invite === "true",
}).catch((error) => {
console.error("Could not resend verification email", error);
throw Error("Could not request email");
});
}
} else if ("userId" in searchParams && userId) {
@@ -54,6 +57,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
await resendVerification({
userId,
isInvite: invite === "true",
}).catch((error) => {
console.error("Could not resend verification email", error);
throw Error("Could not request email");
});
}

View File

@@ -92,6 +92,7 @@ export async function registerUser(command: RegisterUserCommand) {
humanUser,
session.factors.user.organizationId,
command.authRequestId,
//true, // skip send as a mail was send during registration
);
if (emailVerificationCheck?.redirect) {

View File

@@ -62,6 +62,7 @@ export function checkEmailVerification(
humanUser?: HumanUser,
organization?: string,
authRequestId?: string,
skipSend?: boolean,
) {
if (
!humanUser?.email?.isVerified &&
@@ -82,6 +83,10 @@ export function checkEmailVerification(
);
}
if (skipSend) {
params.append("skipsend", "true");
}
return { redirect: `/verify?` + params };
}
}