Fix: clear localstore after logout (#3731)
* fix: remove user, team, and policies from auth store and localstorage on logout * true up the reset everywhere
This commit is contained in:
@@ -204,6 +204,7 @@ export default class AuthStore {
|
|||||||
runInAction("AuthStore#updateUser", () => {
|
runInAction("AuthStore#updateUser", () => {
|
||||||
this.user = null;
|
this.user = null;
|
||||||
this.team = null;
|
this.team = null;
|
||||||
|
this.policies = [];
|
||||||
this.token = null;
|
this.token = null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -259,14 +260,6 @@ export default class AuthStore {
|
|||||||
|
|
||||||
client.post(`/auth.delete`);
|
client.post(`/auth.delete`);
|
||||||
|
|
||||||
// remove user and team from localStorage
|
|
||||||
Storage.set(AUTH_STORE, {
|
|
||||||
user: null,
|
|
||||||
team: null,
|
|
||||||
policies: [],
|
|
||||||
});
|
|
||||||
this.token = null;
|
|
||||||
|
|
||||||
// if this logout was forced from an authenticated route then
|
// if this logout was forced from an authenticated route then
|
||||||
// save the current path so we can go back there once signed in
|
// save the current path so we can go back there once signed in
|
||||||
if (savePath) {
|
if (savePath) {
|
||||||
@@ -290,7 +283,12 @@ export default class AuthStore {
|
|||||||
setCookie("sessions", JSON.stringify(sessions), {
|
setCookie("sessions", JSON.stringify(sessions), {
|
||||||
domain: getCookieDomain(window.location.hostname),
|
domain: getCookieDomain(window.location.hostname),
|
||||||
});
|
});
|
||||||
this.team = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear all credentials from cache (and local storage via autorun)
|
||||||
|
this.user = null;
|
||||||
|
this.team = null;
|
||||||
|
this.policies = [];
|
||||||
|
this.token = null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user