mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 06:52:24 +00:00
rm u2f set cmp
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user