Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset store on logout #6694

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-resetting-store-on-logout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Resetting store on logout

When logging out, only some parts of vuex store were reset to default. This caused bugs by switching to another account that has some other/missing settings. For example, if the account has no quota, the quota of the previously logged in account was shown. We have fixed this by resetting the user store module on logout with reset function (vuex extensions library) and creating an action to reset dynamic nav items.

https://github.com/owncloud/web/pull/6694
https://github.com/owncloud/web/issues/6549
7 changes: 7 additions & 0 deletions packages/web-runtime/src/store/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const mutations = {
}
state.dynamicNavItems = dynamicNavItems
},
/* Sets dynamic nav items */
SET_DYNAMIC_NAV_ITEMS(state, navItems) {
state.dynamicNavItems = navItems
},
SET_CLOSED(state, closed) {
state.closed = closed
}
Expand Down Expand Up @@ -89,6 +93,9 @@ const actions = {
},
closeNavigation({ commit }) {
commit('SET_CLOSED', true)
},
clearDynamicNavItems({ commit }) {
commit('SET_DYNAMIC_NAV_ITEMS', {})
}
}
export default {
Expand Down
11 changes: 5 additions & 6 deletions packages/web-runtime/src/store/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ const actions = {
if (context.state.id === '') {
return
}
// reset user to default state
context.commit('SET_USER', state)
// reset capabilities to default state
context.commit('SET_CAPABILITIES', { capabilities: null, version: null })
// set userReady to false
context.commit('SET_USER_READY', false)
// reset user
this.reset({ self: false, nested: false, modules: { user: { self: true } } })

// clear dynamic navItems
context.dispatch('clearDynamicNavItems')

// clear oidc client state
vueAuthInstance.clearLoginState()
Expand Down