This commit is contained in:
Max Peintner
2025-05-26 10:17:34 +02:00
parent 8204312892
commit 80f106dc65
2 changed files with 9 additions and 50 deletions

View File

@@ -52,7 +52,7 @@ export default async function Page(props: { searchParams: Promise<any> }) {
(requestId ? `&requestId=${requestId}` : ""),
}).catch((error) => {
console.error("Could not send invitation email", error);
throw Error("Failed to send verification email");
throw Error("Failed to send invitation email");
});
} else {
await sendEmailCode({
@@ -160,19 +160,14 @@ export default async function Page(props: { searchParams: Promise<any> }) {
)
)}
{/* always show the code form, except code is an invite code and the email is verified */}
{invite === "true" && human?.email?.isVerified ? (
<Alert type={AlertType.INFO}>{t("success")}</Alert>
) : (
<VerifyForm
loginName={loginName}
organization={organization}
userId={id}
code={code}
isInvite={invite === "true"}
requestId={requestId}
/>
)}
<VerifyForm
loginName={loginName}
organization={organization}
userId={id}
code={code}
isInvite={invite === "true"}
requestId={requestId}
/>
</div>
</DynamicTheme>
);

View File

@@ -255,23 +255,6 @@ export async function sendLoginname(command: SendLoginnameCommand) {
// always resend invite if user has no auth method set
if (!methods.authMethodTypes || !methods.authMethodTypes.length) {
// redirect to /verify invite if no auth method is set and email is not verified
// const inviteCheck = checkEmailVerified(
// session,
// humanUser,
// session.factors.user.organizationId,
// command.requestId,
// );
// if (inviteCheck?.redirect) {
// return inviteCheck;
// }
// // check if user was verified recently
// const isUserVerified = await checkUserVerification(
// session.factors.user.id,
// );
// if (!isUserVerified) {
const params = new URLSearchParams({
loginName: session.factors?.user?.loginName as string,
send: "true", // set this to true to request a new code immediately
@@ -291,25 +274,6 @@ export async function sendLoginname(command: SendLoginnameCommand) {
}
return { redirect: `/verify?` + params };
// }
// const paramsAuthenticatorSetup = new URLSearchParams({
// loginName: session.factors?.user?.loginName,
// userId: session.factors?.user?.id, // verify needs user id
// });
// if (command.organization || session.factors?.user?.organizationId) {
// paramsAuthenticatorSetup.append(
// "organization",
// command.organization ?? session.factors?.user?.organizationId,
// );
// }
// if (command.requestId) {
// paramsAuthenticatorSetup.append("requestId", command.requestId);
// }
// return { redirect: "/authenticator/set?" + paramsAuthenticatorSetup };
}
if (methods.authMethodTypes.length == 1) {