rm u2f set cmp

This commit is contained in:
peintnermax
2024-04-24 08:37:17 +02:00
parent 430d87c1a1
commit 66222888f5

View File

@@ -18,27 +18,10 @@ export default async function Page({
params: Record<string | number | symbol, string | undefined>; params: Record<string | number | symbol, string | undefined>;
}) { }) {
const { loginName, organization } = searchParams; const { loginName, organization } = searchParams;
const { method } = params;
const branding = await getBrandingSettings(server, organization); const branding = await getBrandingSettings(server, organization);
const totpResponse = await loadSession(loginName, organization).then( const totpResponse = await loadSession(loginName, organization).then();
({ session, token }) => {
if (session && session.factors?.user?.id) {
if (method === "time-based") {
return registerTOTP(session.factors.user.id, token);
} else if (method === "sms") {
return addOTPSMS(session.factors.user.id);
} else if (method === "email") {
return addOTPEmail(session.factors.user.id);
} else {
throw new Error("Invalid method");
}
} else {
throw new Error("No session found");
}
}
);
async function loadSession(loginName?: string, organization?: string) { async function loadSession(loginName?: string, organization?: string) {
const recent = await getMostRecentCookieWithLoginname( const recent = await getMostRecentCookieWithLoginname(