Skip to content

Commit

Permalink
Clear electron data when logging out (#10386)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Mar 15, 2023
1 parent f37ae1e commit 1e651bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/BasePlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,12 @@ export default abstract class BasePlatform {
logger.error("idbDelete failed in destroyPickleKey", e);
}
}

/**
* Clear app storage, called when logging out to perform data clean up.
*/
public async clearStorage(): Promise<void> {
window.sessionStorage.clear();
window.localStorage.clear();
}
}
1 change: 1 addition & 0 deletions src/Lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ export async function onLoggedOut(): Promise<void> {
stopMatrixClient();
await clearStorage({ deleteEverything: true });
LifecycleCustomisations.onLoggedOutAndStorageCleared?.();
await PlatformPeg.get()?.clearStorage();

// Do this last, so we can make sure all storage has been cleared and all
// customisations got the memo.
Expand Down

0 comments on commit 1e651bf

Please sign in to comment.