fix tests

This commit is contained in:
Max Peintner
2024-10-29 10:44:03 +01:00
parent 164c7d6905
commit cd6a11e269
7 changed files with 136 additions and 82 deletions

View File

@@ -25,7 +25,7 @@ export function ChooseAuthenticatorToSetup({
} else {
return (
<>
{loginSettings.passkeysType === PasskeysType.ALLOWED &&
{loginSettings.passkeysType === PasskeysType.NOT_ALLOWED &&
!loginSettings.allowUsernamePassword && (
<Alert type={AlertType.ALERT}>{t("noMethodsAvailable")}</Alert>
)}

View File

@@ -3,7 +3,6 @@
import { Alert } from "@/components/alert";
import { resendVerification, sendVerification } from "@/lib/server/email";
import { useTranslations } from "next-intl";
import { useRouter } from "next/navigation";
import { useCallback, useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { Button, ButtonVariants } from "./button";
@@ -35,8 +34,6 @@ export function VerifyForm({ userId, code, isInvite, params }: Props) {
const [loading, setLoading] = useState<boolean>(false);
const router = useRouter();
async function resendCode() {
setError("");
setLoading(true);

View File

@@ -74,7 +74,7 @@ export async function sendVerification(command: VerifyUserByEmailCommand) {
if (session.factors?.user?.loginName) {
params.set("loginName", session.factors?.user?.loginName);
}
return redirect("/authenticator/set?" + params);
return redirect(`/authenticator/set?${params}`);
}
}
@@ -134,6 +134,6 @@ export async function sendVerificationRedirectWithoutCheck(command: {
if (session.factors?.user?.loginName) {
params.set("loginName", session.factors?.user?.loginName);
}
return redirect("/authenticator/set?" + params);
return redirect(`/authenticator/set?${params}`);
}
}

View File

@@ -54,13 +54,7 @@ export async function registerUser(command: RegisterUserCommand) {
checks,
undefined,
command.authRequestId,
).then((session) => {
return {
userId: human.userId,
sessionId: session.id,
factors: session.factors,
};
});
);
if (!session || !session.factors?.user) {
return { error: "Could not create session" };
@@ -83,9 +77,9 @@ export async function registerUser(command: RegisterUserCommand) {
organization: session.factors.user.organizationId,
});
if (command.authRequestId && session.userId) {
if (command.authRequestId && session.factors.user.id) {
params.append("authRequest", command.authRequestId);
params.append("sessionId", session.sessionId);
params.append("sessionId", session.id);
return redirect("/login?" + params);
} else {