mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 06:52:24 +00:00
loadMostRecentSession
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, sessionService } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import LoginOTP from "@/ui/LoginOTP";
|
import LoginOTP from "@/ui/LoginOTP";
|
||||||
@@ -17,7 +17,7 @@ export default async function Page({
|
|||||||
|
|
||||||
const { method } = params;
|
const { method } = params;
|
||||||
|
|
||||||
const session = await loadMostRecentSession(sessionService, {
|
const session = await loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
addOTPSMS,
|
addOTPSMS,
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
registerTOTP,
|
registerTOTP,
|
||||||
sessionService,
|
|
||||||
} from "@/lib/zitadel";
|
} from "@/lib/zitadel";
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import BackButton from "@/ui/BackButton";
|
import BackButton from "@/ui/BackButton";
|
||||||
@@ -27,7 +26,7 @@ export default async function Page({
|
|||||||
const { method } = params;
|
const { method } = params;
|
||||||
|
|
||||||
const branding = await getBrandingSettings(organization);
|
const branding = await getBrandingSettings(organization);
|
||||||
const session = await loadMostRecentSession(sessionService, {
|
const session = await loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, sessionService } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import Alert, { AlertType } from "@/ui/Alert";
|
import Alert, { AlertType } from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import RegisterPasskey from "@/ui/RegisterPasskey";
|
import RegisterPasskey from "@/ui/RegisterPasskey";
|
||||||
@@ -13,7 +13,7 @@ export default async function Page({
|
|||||||
const { loginName, promptPasswordless, organization, authRequestId } =
|
const { loginName, promptPasswordless, organization, authRequestId } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const session = await loadMostRecentSession(sessionService, {
|
const session = await loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getSession, sessionService } from "@/lib/zitadel";
|
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import LoginPasskey from "@/ui/LoginPasskey";
|
import LoginPasskey from "@/ui/LoginPasskey";
|
||||||
@@ -20,7 +20,7 @@ export default async function Page({
|
|||||||
|
|
||||||
const sessionFactors = sessionId
|
const sessionFactors = sessionId
|
||||||
? await loadSessionById(sessionId, organization)
|
? await loadSessionById(sessionId, organization)
|
||||||
: await loadMostRecentSession(sessionService, { loginName, organization });
|
: await loadMostRecentSession({ loginName, organization });
|
||||||
|
|
||||||
async function loadSessionById(sessionId: string, organization?: string) {
|
async function loadSessionById(sessionId: string, organization?: string) {
|
||||||
const recent = await getSessionCookieById({ sessionId, organization });
|
const recent = await getSessionCookieById({ sessionId, organization });
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel";
|
||||||
getBrandingSettings,
|
|
||||||
getLoginSettings,
|
|
||||||
sessionService,
|
|
||||||
} from "@/lib/zitadel";
|
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import PasswordForm from "@/ui/PasswordForm";
|
import PasswordForm from "@/ui/PasswordForm";
|
||||||
@@ -17,7 +13,7 @@ export default async function Page({
|
|||||||
const { loginName, organization, promptPasswordless, authRequestId, alt } =
|
const { loginName, organization, promptPasswordless, authRequestId, alt } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const sessionFactors = await loadMostRecentSession(sessionService, {
|
const sessionFactors = await loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getSession, sessionService } from "@/lib/zitadel";
|
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import LoginPasskey from "@/ui/LoginPasskey";
|
import LoginPasskey from "@/ui/LoginPasskey";
|
||||||
@@ -17,7 +17,7 @@ export default async function Page({
|
|||||||
|
|
||||||
const sessionFactors = sessionId
|
const sessionFactors = sessionId
|
||||||
? await loadSessionById(sessionId, organization)
|
? await loadSessionById(sessionId, organization)
|
||||||
: await loadMostRecentSession(sessionService, { loginName, organization });
|
: await loadMostRecentSession({ loginName, organization });
|
||||||
|
|
||||||
async function loadSessionById(sessionId: string, organization?: string) {
|
async function loadSessionById(sessionId: string, organization?: string) {
|
||||||
const recent = await getSessionCookieById({ sessionId, organization });
|
const recent = await getSessionCookieById({ sessionId, organization });
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, sessionService } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import Alert from "@/ui/Alert";
|
import Alert from "@/ui/Alert";
|
||||||
import DynamicTheme from "@/ui/DynamicTheme";
|
import DynamicTheme from "@/ui/DynamicTheme";
|
||||||
import RegisterU2F from "@/ui/RegisterU2F";
|
import RegisterU2F from "@/ui/RegisterU2F";
|
||||||
@@ -12,7 +12,7 @@ export default async function Page({
|
|||||||
}) {
|
}) {
|
||||||
const { loginName, organization, authRequestId } = searchParams;
|
const { loginName, organization, authRequestId } = searchParams;
|
||||||
|
|
||||||
const sessionFactors = await loadMostRecentSession(sessionService, {
|
const sessionFactors = await loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { loadMostRecentSession } from "./session";
|
import { loadMostRecentSession } from "./session";
|
||||||
import { sessionService, verifyTOTPRegistration } from "./zitadel";
|
import { verifyTOTPRegistration } from "./zitadel";
|
||||||
|
|
||||||
export async function verifyTOTP(
|
export async function verifyTOTP(
|
||||||
code: string,
|
code: string,
|
||||||
loginName?: string,
|
loginName?: string,
|
||||||
organization?: string,
|
organization?: string,
|
||||||
) {
|
) {
|
||||||
return loadMostRecentSession(sessionService, {
|
return loadMostRecentSession({
|
||||||
loginName,
|
loginName,
|
||||||
organization,
|
organization,
|
||||||
}).then((session) => {
|
}).then((session) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user