mirror of
https://github.com/zitadel/zitadel.git
synced 2026-08-18 17:05:03 -05:00
fix(login): passkey reauth (#11365)
# Which Problems Are Solved This PR fixes a problem where expired or cleared sessions could not be reauthenticated when passkey was set as single method. # How the Problems Are Solved The logic now correctly falls back to creating a new session if the context is provided. Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
co-authored by
Livio Spring
parent
7f81b866a5
commit
1e5e3b9b3e
@@ -13,8 +13,8 @@ import { create, Duration } from "@zitadel/client";
|
||||
import { RequestChallenges } from "@zitadel/proto/zitadel/session/v2/challenge_pb";
|
||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||
import { Checks, ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||
import { headers } from "next/headers";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { headers } from "next/headers";
|
||||
import { completeFlowOrGetUrl } from "../client";
|
||||
import {
|
||||
getMostRecentSessionCookie,
|
||||
@@ -192,12 +192,8 @@ export async function updateOrCreateSession(options: UpdateSessionCommand) {
|
||||
lifetime,
|
||||
});
|
||||
} catch (error) {
|
||||
if (!checks) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const loginNameForCreation = options.loginName || recentSession.loginName;
|
||||
const orgForCreation = options.organization || recentSession.organization;
|
||||
const loginNameForCreation = options.loginName || recentSession?.loginName;
|
||||
const orgForCreation = options.organization || recentSession?.organization;
|
||||
|
||||
if (!loginNameForCreation) {
|
||||
throw error;
|
||||
@@ -212,7 +208,7 @@ export async function updateOrCreateSession(options: UpdateSessionCommand) {
|
||||
if (users.details?.totalResult === BigInt(1) && users.result[0].userId) {
|
||||
const user = users.result[0];
|
||||
const newChecks = create(ChecksSchema, {
|
||||
...checks,
|
||||
...(checks || {}),
|
||||
user: { search: { case: "userId", value: user.userId } } as any,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user