[ARVADOS-WORKBENCH2] created: 2.1.0-395-gf0c6cadd
Git user
git at public.arvados.org
Tue May 25 20:13:32 UTC 2021
at f0c6cadd237050fd7b6ebb4f9938bb6ac369ccf0 (commit)
commit f0c6cadd237050fd7b6ebb4f9938bb6ac369ccf0
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Tue May 25 16:13:08 2021 -0400
17722: When saving or removing data from storage, clear both
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index bd4bc196..355cef42 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -51,6 +51,7 @@ export class AuthService {
}
public saveApiToken(token: string) {
+ this.removeApiToken();
this.getStorage().setItem(API_TOKEN_KEY, token);
const sp = token.split('/');
if (sp.length === 3) {
@@ -59,7 +60,8 @@ export class AuthService {
}
public removeTargetURL() {
- this.getStorage().removeItem(TARGET_URL);
+ localStorage.removeItem(TARGET_URL);
+ sessionStorage.removeItem(TARGET_URL);
}
public getTargetURL() {
@@ -67,7 +69,8 @@ export class AuthService {
}
public removeApiToken() {
- this.getStorage().removeItem(API_TOKEN_KEY);
+ localStorage.removeItem(API_TOKEN_KEY);
+ sessionStorage.removeItem(API_TOKEN_KEY);
}
public getApiToken() {
@@ -83,16 +86,18 @@ export class AuthService {
}
public removeUser() {
- this.getStorage().removeItem(USER_EMAIL_KEY);
- this.getStorage().removeItem(USER_FIRST_NAME_KEY);
- this.getStorage().removeItem(USER_LAST_NAME_KEY);
- this.getStorage().removeItem(USER_UUID_KEY);
- this.getStorage().removeItem(USER_OWNER_UUID_KEY);
- this.getStorage().removeItem(USER_IS_ADMIN);
- this.getStorage().removeItem(USER_IS_ACTIVE);
- this.getStorage().removeItem(USER_USERNAME);
- this.getStorage().removeItem(USER_PREFS);
- this.getStorage().removeItem(TARGET_URL);
+ [localStorage, sessionStorage].forEach((storage) => {
+ storage.removeItem(USER_EMAIL_KEY);
+ storage.removeItem(USER_FIRST_NAME_KEY);
+ storage.removeItem(USER_LAST_NAME_KEY);
+ storage.removeItem(USER_UUID_KEY);
+ storage.removeItem(USER_OWNER_UUID_KEY);
+ storage.removeItem(USER_IS_ADMIN);
+ storage.removeItem(USER_IS_ACTIVE);
+ storage.removeItem(USER_USERNAME);
+ storage.removeItem(USER_PREFS);
+ storage.removeItem(TARGET_URL);
+ });
}
public login(uuidPrefix: string, homeCluster: string, loginCluster: string, remoteHosts: { [key: string]: string }) {
@@ -145,11 +150,13 @@ export class AuthService {
}
public saveSessions(sessions: Session[]) {
+ this.removeSessions();
this.getStorage().setItem("sessions", JSON.stringify(sessions));
}
public removeSessions() {
- this.getStorage().removeItem("sessions");
+ localStorage.removeItem("sessions");
+ sessionStorage.removeItem("sessions");
}
public buildSessions(cfg: Config, user?: User) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list