Skip to content

Commit

Permalink
clear BrowserStorage with possibly sensitive data when another user i…
Browse files Browse the repository at this point in the history
…s logged in on this device

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Aug 22, 2023
1 parent 394f1a1 commit 7f8ce07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ export default {
},
},
beforeCreate() {
const authorizedUser = getCurrentUser()?.uid || null
const lastLoggedInUser = BrowserStorage.getItem('last_logged_in_user')
if (authorizedUser !== lastLoggedInUser) {
// TODO introduce helper/util to list and clear all sensitive data
// or create BrowserSensitiveStorage for this purposes,
// if we have more than one source
BrowserStorage.removeItem('cachedConversations')
}
if (authorizedUser) {
BrowserStorage.setItem('last_logged_in_user', authorizedUser)
}
},
beforeDestroy() {
if (!getCurrentUser()) {
EventBus.$off('should-refresh-conversations', this.debounceRefreshCurrentConversation)
Expand Down

0 comments on commit 7f8ce07

Please sign in to comment.