Skip to content
Snippets Groups Projects
Commit 646b4e55 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

Check localStorage auth

parent 83e9328f
No related branches found
No related tags found
1 merge request!46Not being loged out from the dashboard after logging out of chrome extension
......@@ -1215,6 +1215,10 @@ connection.promise.then(parent => {
let identityLoadedEvent = false;
let identityAuthenticatedEvent = false;
let previousLocalStorageUUID;
let previousLocalStorageToken;
let previousLocalStorageIdentity;
setInterval(async function () {
if (window.currentlyAuthenticatedIdentity) {
const { authentication } = window.currentlyAuthenticatedIdentity;
......@@ -1270,6 +1274,28 @@ connection.promise.then(parent => {
window.lastTimeGetProfile = now;
}
}
const currentLocalStorageUUID = localStorage.getItem("uuid");
const currentLocalStorageToken = localStorage.getItem("token");
const currentLocalStorageIdentity = localStorage.getItem("authenticatedIdentity");
if (
!currentLocalStorageUUID && previousLocalStorageUUID ||
!currentLocalStorageToken && previousLocalStorageToken ||
!currentLocalStorageIdentity && previousLocalStorageIdentity
) {
previousLocalStorageUUID = null;
previousLocalStorageToken = null;
previousLocalStorageIdentity = null;
destroyAuthentication();
const event = createEvent("", "LogoutExternal");
parent.onEvent(event);
} else {
previousLocalStorageUUID = currentLocalStorageUUID;
previousLocalStorageToken = currentLocalStorageToken;
previousLocalStorageIdentity = currentLocalStorageIdentity;
}
}, 50);
setInterval(async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment