mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 09:27:36 +00:00
logout redirects
This commit is contained in:
@@ -27,6 +27,7 @@ export function SessionsClearList({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
async function clearHintedSession() {
|
async function clearHintedSession() {
|
||||||
|
console.log("Clearing session for login hint:", loginHint);
|
||||||
// If a login hint is provided, we logout that specific session
|
// If a login hint is provided, we logout that specific session
|
||||||
const sessionIdToBeCleared = sessions.find((session) => {
|
const sessionIdToBeCleared = sessions.find((session) => {
|
||||||
return session.factors?.user?.loginName === loginHint;
|
return session.factors?.user?.loginName === loginHint;
|
||||||
@@ -35,6 +36,9 @@ export function SessionsClearList({
|
|||||||
if (sessionIdToBeCleared) {
|
if (sessionIdToBeCleared) {
|
||||||
const clearSessionResponse = await clearSession({
|
const clearSessionResponse = await clearSession({
|
||||||
sessionId: sessionIdToBeCleared,
|
sessionId: sessionIdToBeCleared,
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error("Error clearing session:", error);
|
||||||
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!clearSessionResponse) {
|
if (!clearSessionResponse) {
|
||||||
@@ -58,7 +62,9 @@ export function SessionsClearList({
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
clearHintedSession();
|
if (loginHint) {
|
||||||
|
clearHintedSession();
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return sessions ? (
|
return sessions ? (
|
||||||
|
@@ -141,7 +141,7 @@ export async function removeSessionFromCookie<T>({
|
|||||||
session: SessionCookie<T>;
|
session: SessionCookie<T>;
|
||||||
cleanup?: boolean;
|
cleanup?: boolean;
|
||||||
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
||||||
}): Promise<any> {
|
}) {
|
||||||
const cookiesList = await cookies();
|
const cookiesList = await cookies();
|
||||||
const stringifiedCookie = cookiesList.get("sessions");
|
const stringifiedCookie = cookiesList.get("sessions");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user