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