From 263a51938d894896306fab155737aecc7c74b04a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 25 May 2017 17:16:16 +0100 Subject: [PATCH] Reset store state when logging out This prevents leaking of state that we do not want to share with the next user --- src/stores/LifecycleStore.js | 5 +++++ src/stores/RoomViewStore.js | 3 +++ src/stores/SessionStore.js | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/stores/LifecycleStore.js b/src/stores/LifecycleStore.js index 43e2de9d52..5dfe82500a 100644 --- a/src/stores/LifecycleStore.js +++ b/src/stores/LifecycleStore.js @@ -61,6 +61,11 @@ class LifecycleStore extends Store { }); dis.dispatch(deferredAction); break; + case 'on_logged_out': + this._state = { + deferred_action: null, + }; + break; } } } diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index 1ceef551a8..d893318af7 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -73,6 +73,9 @@ class RoomViewStore extends Store { case 'join_room': this._joinRoom(payload); break; + case 'on_logged_out': + this.reset(); + break; } } diff --git a/src/stores/SessionStore.js b/src/stores/SessionStore.js index 2fd35ce40a..5713e4d321 100644 --- a/src/stores/SessionStore.js +++ b/src/stores/SessionStore.js @@ -66,6 +66,11 @@ class SessionStore extends Store { cachedPassword: null, }); break; + case 'on_logged_out': + this._state = { + cachedPassword: null, + }; + break; } }