mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-03 06:22:54 +00:00
fix(login): use /logout/done as success page, accept post_logout_redirect param as post logout uri (#10500)
Closes #10413 This PR changes the logout success page of the V2 login to `/logout/done` and accepts both `post_logout_redirect` as well as `post_logout_redirect_uri` as a param for the post logout url. # Which Problems Are Solved The new Login V2 aligns with the login V1 now. Accepts `post_logout_redirect` as well as `post_logout_redirect_uri` as a param for the post logout url. # How the Problems Are Solved Both search params are now accepted.
This commit is contained in:
@@ -3,11 +3,7 @@ import { SessionsClearList } from "@/components/sessions-clear-list";
|
||||
import { Translated } from "@/components/translated";
|
||||
import { getAllSessionCookieIds } from "@/lib/cookies";
|
||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
||||
import {
|
||||
getBrandingSettings,
|
||||
getDefaultOrg,
|
||||
listSessions,
|
||||
} from "@/lib/zitadel";
|
||||
import { getBrandingSettings, getDefaultOrg, listSessions } from "@/lib/zitadel";
|
||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
@@ -26,13 +22,11 @@ async function loadSessions({ serviceUrl }: { serviceUrl: string }) {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Page(props: {
|
||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||
}) {
|
||||
export default async function Page(props: { searchParams: Promise<Record<string | number | symbol, string | undefined>> }) {
|
||||
const searchParams = await props.searchParams;
|
||||
|
||||
const organization = searchParams?.organization;
|
||||
const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri;
|
||||
const postLogoutRedirectUri = searchParams?.post_logout_redirect || searchParams?.post_logout_redirect_uri;
|
||||
const logoutHint = searchParams?.logout_hint;
|
||||
// TODO implement with new translation service
|
||||
// const UILocales = searchParams?.ui_locales;
|
||||
|
||||
@@ -16,12 +16,7 @@ type Props = {
|
||||
organization?: string;
|
||||
};
|
||||
|
||||
export function SessionsClearList({
|
||||
sessions,
|
||||
logoutHint,
|
||||
postLogoutRedirectUri,
|
||||
organization,
|
||||
}: Props) {
|
||||
export function SessionsClearList({ sessions, logoutHint, postLogoutRedirectUri, organization }: Props) {
|
||||
const [list, setList] = useState<Session[]>(sessions);
|
||||
const router = useRouter();
|
||||
|
||||
@@ -54,7 +49,7 @@ export function SessionsClearList({
|
||||
params.set("organization", organization);
|
||||
}
|
||||
|
||||
return router.push("/logout/success?" + params);
|
||||
return router.push("/logout/done?" + params);
|
||||
} else {
|
||||
console.warn(`No session found for login hint: ${logoutHint}`);
|
||||
}
|
||||
@@ -72,12 +67,8 @@ export function SessionsClearList({
|
||||
.filter((session) => session?.factors?.user?.loginName)
|
||||
// sort by change date descending
|
||||
.sort((a, b) => {
|
||||
const dateA = a.changeDate
|
||||
? timestampDate(a.changeDate).getTime()
|
||||
: 0;
|
||||
const dateB = b.changeDate
|
||||
? timestampDate(b.changeDate).getTime()
|
||||
: 0;
|
||||
const dateA = a.changeDate ? timestampDate(a.changeDate).getTime() : 0;
|
||||
const dateB = b.changeDate ? timestampDate(b.changeDate).getTime() : 0;
|
||||
return dateB - dateA;
|
||||
})
|
||||
// TODO: add sorting to move invalid sessions to the bottom
|
||||
|
||||
Reference in New Issue
Block a user