mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 18:02:33 +00:00
redirect to totp from password form
This commit is contained in:
@@ -98,8 +98,10 @@ export async function PUT(request: NextRequest) {
|
|||||||
password,
|
password,
|
||||||
webAuthN,
|
webAuthN,
|
||||||
challenges,
|
challenges,
|
||||||
|
undefined,
|
||||||
authRequestId
|
authRequestId
|
||||||
).then((session) => {
|
).then((session) => {
|
||||||
|
console.log(session);
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
sessionId: session.id,
|
sessionId: session.id,
|
||||||
factors: session.factors,
|
factors: session.factors,
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import { useForm } from "react-hook-form";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { Spinner } from "./Spinner";
|
import { Spinner } from "./Spinner";
|
||||||
import Alert from "./Alert";
|
import Alert from "./Alert";
|
||||||
|
import { LoginSettings } from "@zitadel/server";
|
||||||
|
|
||||||
type Inputs = {
|
type Inputs = {
|
||||||
password: string;
|
password: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
loginSettings: LoginSettings | undefined;
|
||||||
loginName?: string;
|
loginName?: string;
|
||||||
organization?: string;
|
organization?: string;
|
||||||
authRequestId?: string;
|
authRequestId?: string;
|
||||||
@@ -21,6 +23,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function PasswordForm({
|
export default function PasswordForm({
|
||||||
|
loginSettings,
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
authRequestId,
|
authRequestId,
|
||||||
@@ -83,6 +86,19 @@ export default function PasswordForm({
|
|||||||
|
|
||||||
return router.push(`/passkey/add?` + params);
|
return router.push(`/passkey/add?` + params);
|
||||||
} else {
|
} else {
|
||||||
|
let continueWithMfa = undefined;
|
||||||
|
if (
|
||||||
|
loginSettings?.forceMfa &&
|
||||||
|
loginSettings.secondFactors?.length >= 1 // TODO replace with user methods - if forceMFA is set and no user methods prompt to add method (/mfa/add)
|
||||||
|
) {
|
||||||
|
if (loginSettings.secondFactors?.length === 1) {
|
||||||
|
continueWithMfa = loginSettings.secondFactors[0];
|
||||||
|
} else {
|
||||||
|
// continueWithMfa = loginSettings.secondFactors[0];
|
||||||
|
// render selection page for mfa (/mfa/select)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// OIDC flows
|
||||||
if (authRequestId && resp && resp.sessionId) {
|
if (authRequestId && resp && resp.sessionId) {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
sessionId: resp.sessionId,
|
sessionId: resp.sessionId,
|
||||||
@@ -95,6 +111,7 @@ export default function PasswordForm({
|
|||||||
|
|
||||||
return router.push(`/login?` + params);
|
return router.push(`/login?` + params);
|
||||||
} else {
|
} else {
|
||||||
|
// without OIDC flow
|
||||||
const params = new URLSearchParams(
|
const params = new URLSearchParams(
|
||||||
authRequestId
|
authRequestId
|
||||||
? {
|
? {
|
||||||
|
|||||||
Reference in New Issue
Block a user