diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js
index 0851c01a18..240a3499a2 100644
--- a/src/components/structures/LoggedInView.js
+++ b/src/components/structures/LoggedInView.js
@@ -23,6 +23,7 @@ import Notifier from '../../Notifier';
import PageTypes from '../../PageTypes';
import sdk from '../../index';
import dis from '../../dispatcher';
+import sessionStore from '../../stores/SessionStore';
/**
* This is what our MatrixChat shows when we are logged in. The precise view is
@@ -49,10 +50,6 @@ export default React.createClass({
teamToken: React.PropTypes.string,
- // Has the user generated a password that is stored in local storage?
- // (are they a PWLU?)
- userHasGeneratedPassword: React.PropTypes.bool,
-
// and lots and lots of other stuff.
},
@@ -80,6 +77,10 @@ export default React.createClass({
this._scrollStateMap = {};
document.addEventListener('keydown', this._onKeyDown);
+
+ this._sessionStore = sessionStore;
+ this._sessionStore.addListener(this._setStateFromSessionStore);
+ this._setStateFromSessionStore();
},
componentWillUnmount: function() {
@@ -97,6 +98,12 @@ export default React.createClass({
return this.refs.roomView.canResetTimeline();
},
+ _setStateFromSessionStore() {
+ this.setState({
+ userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
+ });
+ },
+
_onKeyDown: function(ev) {
/*
// Remove this for now as ctrl+alt = alt-gr so this breaks keyboards which rely on alt-gr for numbers
@@ -257,7 +264,7 @@ export default React.createClass({
/>;
} else if (this.props.matrixClient.isGuest()) {
topBar = ;
- } else if (this.props.userHasGeneratedPassword) {
+ } else if (this.state.userHasGeneratedPassword) {
topBar = ;
} else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
topBar = ;
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 4556148986..45b4d07055 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -40,8 +40,6 @@ var PageTypes = require('../../PageTypes');
var createRoom = require("../../createRoom");
import * as UDEHandler from '../../UnknownDeviceErrorHandler';
-import sessionStore from '../../stores/SessionStore';
-
module.exports = React.createClass({
displayName: 'MatrixChat',
@@ -250,10 +248,6 @@ module.exports = React.createClass({
register_hs_url: paramHs,
});
}
-
- this._sessionStore = sessionStore;
- this._sessionStore.addListener(this._setStateFromSessionStore);
- this._setStateFromSessionStore();
},
componentDidMount: function() {
@@ -897,12 +891,6 @@ module.exports = React.createClass({
});
},
- _setStateFromSessionStore() {
- this.setState({
- userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
- });
- },
-
onFocus: function(ev) {
dis.dispatch({action: 'focus_composer'});
},