mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
Frontend: Fix OIDC session restore and logout cleanup #5476
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
9219d14d3f
commit
04c57e2b96
9 changed files with 309 additions and 35 deletions
|
|
@ -22,8 +22,7 @@
|
|||
const namespaceKey = rawNamespace && rawNamespace !== "null" && rawNamespace !== "undefined" ? String(rawNamespace) : "root";
|
||||
const prefix = `pp:${namespaceKey}:`;
|
||||
const namespacedKey = (key) => `${prefix}${key}`;
|
||||
const legacyKeys = [
|
||||
"session",
|
||||
const sessionDataKeys = [
|
||||
"session.token",
|
||||
"session.id",
|
||||
"session.data",
|
||||
|
|
@ -40,8 +39,10 @@
|
|||
: localStorage;
|
||||
const clearSessionData = () => {
|
||||
storages.forEach((storage) => {
|
||||
legacyKeys.forEach((key) => storage.removeItem(key));
|
||||
legacyKeys.forEach((key) => storage.removeItem(namespacedKey(key)));
|
||||
// Preserve the storage-mode preference so the login page keeps using
|
||||
// sessionStorage when "Stay signed in on this device" is disabled.
|
||||
sessionDataKeys.forEach((key) => storage.removeItem(key));
|
||||
sessionDataKeys.forEach((key) => storage.removeItem(namespacedKey(key)));
|
||||
});
|
||||
};
|
||||
const setItem = (key, value) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue