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