mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 17:47:32 +00:00
logout page
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Ein weiteres Konto hinzufügen",
|
||||
"noResults": "Keine Konten gefunden"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Logout",
|
||||
"description": "Wählen Sie den Account aus, das Sie entfernen möchten"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "Willkommen zurück!",
|
||||
"description": "Geben Sie Ihre Anmeldedaten ein.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Add another account",
|
||||
"noResults": "No accounts found"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Logout",
|
||||
"description": "Select the account you want to clear"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "Welcome back!",
|
||||
"description": "Enter your login data.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Agregar otra cuenta",
|
||||
"noResults": "No se encontraron cuentas"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Cerrar sesión",
|
||||
"description": "Selecciona la cuenta que deseas eliminar"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "¡Bienvenido de nuevo!",
|
||||
"description": "Introduce tus datos de acceso.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Aggiungi un altro account",
|
||||
"noResults": "Nessun account trovato"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Esci",
|
||||
"description": "Seleziona l'account che desideri uscire"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "Bentornato!",
|
||||
"description": "Inserisci i tuoi dati di accesso.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Dodaj kolejne konto",
|
||||
"noResults": "Nie znaleziono kont"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Wyloguj się",
|
||||
"description": "Wybierz konto, które chcesz usunąć"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "Witamy ponownie!",
|
||||
"description": "Wprowadź dane logowania.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "Добавить другой аккаунт",
|
||||
"noResults": "Аккаунты не найдены"
|
||||
},
|
||||
"logout": {
|
||||
"title": "Выход",
|
||||
"description": "Выберите аккаунт, который хотите удалить"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "С возвращением!",
|
||||
"description": "Введите свои данные для входа.",
|
||||
|
@@ -8,6 +8,10 @@
|
||||
"addAnother": "添加另一个账户",
|
||||
"noResults": "未找到账户"
|
||||
},
|
||||
"logout": {
|
||||
"title": "注销",
|
||||
"description": "选择您想注销的账户"
|
||||
},
|
||||
"loginname": {
|
||||
"title": "欢迎回来!",
|
||||
"description": "请输入您的登录信息。",
|
||||
|
81
apps/login/src/app/(login)/logout/page.tsx
Normal file
81
apps/login/src/app/(login)/logout/page.tsx
Normal file
@@ -0,0 +1,81 @@
|
||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||
import { SessionsList } from "@/components/sessions-list";
|
||||
import { getAllSessionCookieIds } from "@/lib/cookies";
|
||||
import { getServiceUrlFromHeaders } from "@/lib/service";
|
||||
import {
|
||||
getBrandingSettings,
|
||||
getDefaultOrg,
|
||||
listSessions,
|
||||
} from "@/lib/zitadel";
|
||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||
import { getLocale, getTranslations } from "next-intl/server";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
async function loadSessions({ serviceUrl }: { serviceUrl: string }) {
|
||||
const ids: (string | undefined)[] = await getAllSessionCookieIds();
|
||||
|
||||
if (ids && ids.length) {
|
||||
const response = await listSessions({
|
||||
serviceUrl,
|
||||
ids: ids.filter((id) => !!id) as string[],
|
||||
});
|
||||
return response?.sessions ?? [];
|
||||
} else {
|
||||
console.info("No session cookie found.");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Page(props: {
|
||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||
}) {
|
||||
const searchParams = await props.searchParams;
|
||||
const locale = getLocale();
|
||||
const t = await getTranslations({ locale, namespace: "logout" });
|
||||
|
||||
const requestId = searchParams?.requestId;
|
||||
const organization = searchParams?.organization;
|
||||
|
||||
const _headers = await headers();
|
||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
||||
|
||||
let defaultOrganization;
|
||||
if (!organization) {
|
||||
const org: Organization | null = await getDefaultOrg({
|
||||
serviceUrl,
|
||||
});
|
||||
if (org) {
|
||||
defaultOrganization = org.id;
|
||||
}
|
||||
}
|
||||
|
||||
let sessions = await loadSessions({ serviceUrl });
|
||||
|
||||
const branding = await getBrandingSettings({
|
||||
serviceUrl,
|
||||
organization: organization ?? defaultOrganization,
|
||||
});
|
||||
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (requestId) {
|
||||
params.append("requestId", requestId);
|
||||
}
|
||||
|
||||
if (organization) {
|
||||
params.append("organization", organization);
|
||||
}
|
||||
|
||||
return (
|
||||
<DynamicTheme branding={branding}>
|
||||
<div className="flex flex-col items-center space-y-4">
|
||||
<h1>{t("title")}</h1>
|
||||
<p className="ztdl-p mb-6 block">{t("description")}</p>
|
||||
|
||||
<div className="flex flex-col w-full space-y-2">
|
||||
<SessionsList sessions={sessions} requestId={requestId} />
|
||||
</div>
|
||||
</div>
|
||||
</DynamicTheme>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user