mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 03:23:40 +00:00
set context in url for method
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
import {
|
||||
addOTPEmail,
|
||||
addOTPSMS,
|
||||
getBrandingSettings,
|
||||
getSession,
|
||||
registerTOTP,
|
||||
server,
|
||||
} from "#/lib/zitadel";
|
||||
import { getBrandingSettings, getSession, server } from "#/lib/zitadel";
|
||||
import DynamicTheme from "#/ui/DynamicTheme";
|
||||
import TOTPRegister from "#/ui/TOTPRegister";
|
||||
import { getMostRecentCookieWithLoginname } from "#/utils/cookies";
|
||||
|
||||
export default async function Page({
|
||||
@@ -21,7 +13,7 @@ export default async function Page({
|
||||
|
||||
const branding = await getBrandingSettings(server, organization);
|
||||
|
||||
const totpResponse = await loadSession(loginName, organization).then();
|
||||
const session = await loadSession(loginName, organization);
|
||||
|
||||
async function loadSession(loginName?: string, organization?: string) {
|
||||
const recent = await getMostRecentCookieWithLoginname(
|
||||
@@ -41,18 +33,6 @@ export default async function Page({
|
||||
<p className="ztdl-p">
|
||||
Choose a device to register for 2-Factor Authentication.
|
||||
</p>
|
||||
|
||||
<div>
|
||||
{/* {auth && <div>{auth.to}</div>} */}
|
||||
{totpResponse &&
|
||||
"uri" in totpResponse &&
|
||||
"secret" in totpResponse && (
|
||||
<TOTPRegister
|
||||
uri={totpResponse.uri as string}
|
||||
secret={totpResponse.secret as string}
|
||||
></TOTPRegister>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</DynamicTheme>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { AuthenticationMethodType, LoginSettings } from "@zitadel/server";
|
||||
import {
|
||||
AuthenticationMethodType,
|
||||
LoginSettings,
|
||||
login,
|
||||
} from "@zitadel/server";
|
||||
import Link from "next/link";
|
||||
import { BadgeState, StateBadge } from "./StateBadge";
|
||||
import clsx from "clsx";
|
||||
@@ -29,10 +33,25 @@ export default function ChooseSecondFactorToSetup({
|
||||
alreadyAdded ? "" : "hover:shadow-lg hover:dark:bg-white/10"
|
||||
);
|
||||
|
||||
const params = new URLSearchParams({});
|
||||
|
||||
if (loginName) {
|
||||
params.append("loginName", loginName);
|
||||
}
|
||||
if (sessionId) {
|
||||
params.append("sessionId", sessionId);
|
||||
}
|
||||
if (authRequestId) {
|
||||
params.append("authRequestId", authRequestId);
|
||||
}
|
||||
if (organization) {
|
||||
params.append("organization", organization);
|
||||
}
|
||||
|
||||
const TOTP = (alreadyAdded: boolean) => {
|
||||
return (
|
||||
<Link
|
||||
href={userMethods.includes(4) ? "" : "/otp/time-based/set"}
|
||||
href={userMethods.includes(4) ? "" : "/otp/time-based/set?" + params}
|
||||
className={cardClasses(alreadyAdded)}
|
||||
>
|
||||
<div
|
||||
@@ -95,7 +114,7 @@ C72,238.87917,85.87916,225,102.99997,225H248z"
|
||||
|
||||
const U2F = (alreadyAdded: boolean) => {
|
||||
return (
|
||||
<Link href="/u2f/set" className={cardClasses(alreadyAdded)}>
|
||||
<Link href={"/u2f/set?" + params} className={cardClasses(alreadyAdded)}>
|
||||
<div
|
||||
className={clsx(
|
||||
"font-medium flex items-center",
|
||||
@@ -129,7 +148,10 @@ C72,238.87917,85.87916,225,102.99997,225H248z"
|
||||
|
||||
const EMAIL = (alreadyAdded: boolean) => {
|
||||
return (
|
||||
<Link href="/otp/email/set" className={cardClasses(alreadyAdded)}>
|
||||
<Link
|
||||
href={"/otp/email/set?" + params}
|
||||
className={cardClasses(alreadyAdded)}
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
"font-medium flex items-center",
|
||||
@@ -164,7 +186,10 @@ C72,238.87917,85.87916,225,102.99997,225H248z"
|
||||
|
||||
const SMS = (alreadyAdded: boolean) => {
|
||||
return (
|
||||
<Link href="/otp/sms/set" className={cardClasses(alreadyAdded)}>
|
||||
<Link
|
||||
href={"/otp/sms/set?" + params}
|
||||
className={cardClasses(alreadyAdded)}
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
"font-medium flex items-center",
|
||||
|
||||
Reference in New Issue
Block a user