diff --git a/apps/login/locales/de.json b/apps/login/locales/de.json index 9538be67ef..c2d0dff36a 100644 --- a/apps/login/locales/de.json +++ b/apps/login/locales/de.json @@ -12,7 +12,11 @@ "title": "Logout", "description": "Wählen Sie den Account aus, das Sie entfernen möchten", "noResults": "Keine Konten gefunden", - "clear": "Entfernen" + "clear": "Entfernen", + "success": { + "title": "Logout erfolgreich", + "description": "Sie haben sich erfolgreich abgemeldet." + } }, "loginname": { "title": "Willkommen zurück!", diff --git a/apps/login/locales/en.json b/apps/login/locales/en.json index 1fa1047e7f..cf9ba16267 100644 --- a/apps/login/locales/en.json +++ b/apps/login/locales/en.json @@ -12,7 +12,11 @@ "title": "Logout", "description": "Click the accounts you want to clear", "noResults": "No accounts found", - "clear": "Clear" + "clear": "Clear", + "success": { + "title": "Logout successful", + "description": "You have successfully logged out." + } }, "loginname": { "title": "Welcome back!", diff --git a/apps/login/locales/es.json b/apps/login/locales/es.json index 7d67805031..fe2b8a5b8e 100644 --- a/apps/login/locales/es.json +++ b/apps/login/locales/es.json @@ -12,7 +12,11 @@ "title": "Cerrar sesión", "description": "Selecciona la cuenta que deseas eliminar", "noResults": "No se encontraron cuentas", - "clear": "Eliminar" + "clear": "Eliminar", + "success": { + "title": "Cierre de sesión exitoso", + "description": "Has cerrado sesión correctamente." + } }, "loginname": { "title": "¡Bienvenido de nuevo!", diff --git a/apps/login/locales/it.json b/apps/login/locales/it.json index 4a6a36daa1..ce46cb0273 100644 --- a/apps/login/locales/it.json +++ b/apps/login/locales/it.json @@ -12,7 +12,11 @@ "title": "Esci", "description": "Seleziona l'account che desideri uscire", "noResults": "Nessun account trovato", - "clear": "Rimuovi" + "clear": "Rimuovi", + "success": { + "title": "Uscita riuscita", + "description": "Hai effettuato l'uscita con successo." + } }, "loginname": { "title": "Bentornato!", diff --git a/apps/login/locales/pl.json b/apps/login/locales/pl.json index 52224cf470..2490f5105a 100644 --- a/apps/login/locales/pl.json +++ b/apps/login/locales/pl.json @@ -12,7 +12,11 @@ "title": "Wyloguj się", "description": "Wybierz konto, które chcesz usunąć", "noResults": "Nie znaleziono kont", - "clear": "Usuń" + "clear": "Usuń", + "success": { + "title": "Wylogowanie udane", + "description": "Pomyślnie się wylogowałeś." + } }, "loginname": { "title": "Witamy ponownie!", diff --git a/apps/login/locales/ru.json b/apps/login/locales/ru.json index 2d2240ff31..e4bff416a5 100644 --- a/apps/login/locales/ru.json +++ b/apps/login/locales/ru.json @@ -12,7 +12,11 @@ "title": "Выход", "description": "Выберите аккаунт, который хотите удалить", "noResults": "Аккаунты не найдены", - "clear": "Удалить" + "clear": "Удалить", + "success": { + "title": "Выход выполнен успешно", + "description": "Вы успешно вышли из системы." + } }, "loginname": { "title": "С возвращением!", diff --git a/apps/login/locales/zh.json b/apps/login/locales/zh.json index 427262cabd..6a1d39b8ab 100644 --- a/apps/login/locales/zh.json +++ b/apps/login/locales/zh.json @@ -12,7 +12,11 @@ "title": "注销", "description": "选择您想注销的账户", "noResults": "未找到账户", - "clear": "清除" + "clear": "清除", + "success": { + "title": "注销成功", + "description": "您已成功注销。" + } }, "loginname": { "title": "欢迎回来!", diff --git a/apps/login/src/app/(login)/logout/page.tsx b/apps/login/src/app/(login)/logout/page.tsx index 5fcf5511da..cdace593b6 100644 --- a/apps/login/src/app/(login)/logout/page.tsx +++ b/apps/login/src/app/(login)/logout/page.tsx @@ -1,7 +1,7 @@ import { DynamicTheme } from "@/components/dynamic-theme"; import { SessionsClearList } from "@/components/sessions-clear-list"; import { getAllSessionCookieIds } from "@/lib/cookies"; -import { getServiceUrlFromHeaders } from "@/lib/service"; +import { getServiceUrlFromHeaders } from "@/lib/service-url"; import { getBrandingSettings, getDefaultOrg, @@ -35,6 +35,7 @@ export default async function Page(props: { const organization = searchParams?.organization; const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri; + const loginHint = searchParams?.login_hint; const _headers = await headers(); const { serviceUrl } = getServiceUrlFromHeaders(_headers); @@ -71,7 +72,9 @@ export default async function Page(props: {
diff --git a/apps/login/src/app/(login)/logout/success/page.tsx b/apps/login/src/app/(login)/logout/success/page.tsx new file mode 100644 index 0000000000..da98092852 --- /dev/null +++ b/apps/login/src/app/(login)/logout/success/page.tsx @@ -0,0 +1,41 @@ +import { DynamicTheme } from "@/components/dynamic-theme"; +import { getServiceUrlFromHeaders } from "@/lib/service-url"; +import { getBrandingSettings, getDefaultOrg } 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"; + +export default async function Page(props: { searchParams: Promise }) { + const searchParams = await props.searchParams; + const locale = getLocale(); + const t = await getTranslations({ locale, namespace: "logout" }); + + const _headers = await headers(); + const { serviceUrl } = getServiceUrlFromHeaders(_headers); + + const { login_hint, organization } = searchParams; + + let defaultOrganization; + if (!organization) { + const org: Organization | null = await getDefaultOrg({ + serviceUrl, + }); + if (org) { + defaultOrganization = org.id; + } + } + + const branding = await getBrandingSettings({ + serviceUrl, + organization, + }); + + return ( + +
+

{t("success.title")}

+

{t("success.description")}

+
+
+ ); +} diff --git a/apps/login/src/app/(login)/verify/success/page.tsx b/apps/login/src/app/(login)/verify/success/page.tsx index 678687a7f6..1668e2e3fd 100644 --- a/apps/login/src/app/(login)/verify/success/page.tsx +++ b/apps/login/src/app/(login)/verify/success/page.tsx @@ -1,35 +1,16 @@ import { DynamicTheme } from "@/components/dynamic-theme"; import { UserAvatar } from "@/components/user-avatar"; -import { getSessionCookieById } from "@/lib/cookies"; import { getServiceUrlFromHeaders } from "@/lib/service-url"; import { loadMostRecentSession } from "@/lib/session"; import { getBrandingSettings, getLoginSettings, - getSession, getUserByID, } from "@/lib/zitadel"; import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb"; import { getLocale, getTranslations } from "next-intl/server"; import { headers } from "next/headers"; -async function loadSessionById( - serviceUrl: string, - sessionId: string, - organization?: string, -) { - const recent = await getSessionCookieById({ sessionId, organization }); - return getSession({ - serviceUrl, - sessionId: recent.id, - sessionToken: recent.token, - }).then((response) => { - if (response?.session) { - return response.session; - } - }); -} - export default async function Page(props: { searchParams: Promise }) { const searchParams = await props.searchParams; const locale = getLocale(); diff --git a/apps/login/src/components/session-clear-item.tsx b/apps/login/src/components/session-clear-item.tsx index 226d861ec7..fdfca4939d 100644 --- a/apps/login/src/components/session-clear-item.tsx +++ b/apps/login/src/components/session-clear-item.tsx @@ -1,6 +1,6 @@ "use client"; -import { cleanupSession } from "@/lib/server/session"; +import { clearSession } from "@/lib/server/session"; import { timestampDate } from "@zitadel/client"; import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb"; import moment from "moment"; @@ -24,9 +24,9 @@ export function SessionClearItem({ const [loading, setLoading] = useState(false); - async function clearSession(id: string) { + async function clearSessionId(id: string) { setLoading(true); - const response = await cleanupSession({ + const response = await clearSession({ sessionId: id, }) .catch((error) => { @@ -49,7 +49,7 @@ export function SessionClearItem({ return (