move cookie utils to @zitadel/next package

This commit is contained in:
peintnermax
2024-08-07 15:53:55 +02:00
parent 6e2441feac
commit a58ccbf671
14 changed files with 4512 additions and 5581 deletions

View File

@@ -5,6 +5,7 @@ import RegisterPasskey from "@/ui/RegisterPasskey";
import RegisterU2F from "@/ui/RegisterU2F";
import UserAvatar from "@/ui/UserAvatar";
import { getMostRecentCookieWithLoginname } from "@/utils/cookies";
import { loadMostRecentSession } from "@zitadel/next";
export default async function Page({
searchParams,
@@ -13,19 +14,8 @@ export default async function Page({
}) {
const { loginName, organization, authRequestId } = searchParams;
const sessionFactors = await loadSession(loginName);
const sessionFactors = await loadMostRecentSession(loginName, organization);
async function loadSession(loginName?: string) {
const recent = await getMostRecentCookieWithLoginname(
loginName,
organization,
);
return getSession(recent.id, recent.token).then((response) => {
if (response?.session) {
return response.session;
}
});
}
const title = "Use your passkey to confirm it's really you";
const description =
"Your device will ask for your fingerprint, face, or screen lock";