diff --git a/apps/login/app/(login)/u2f/set/page.tsx b/apps/login/app/(login)/u2f/set/page.tsx index 3b9570b0..c3b498df 100644 --- a/apps/login/app/(login)/u2f/set/page.tsx +++ b/apps/login/app/(login)/u2f/set/page.tsx @@ -18,27 +18,10 @@ export default async function Page({ params: Record; }) { const { loginName, organization } = searchParams; - const { method } = params; const branding = await getBrandingSettings(server, organization); - 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"); - } - } - ); + const totpResponse = await loadSession(loginName, organization).then(); async function loadSession(loginName?: string, organization?: string) { const recent = await getMostRecentCookieWithLoginname(