diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index fc13f0bdcf..58ae46e18a 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -21,6 +21,7 @@ const MatrixClientPeg = require("../../MatrixClientPeg"); const PlatformPeg = require("../../PlatformPeg"); const Modal = require('../../Modal'); const dis = require("../../dispatcher"); +import sessionStore from '../../stores/SessionStore'; const q = require('q'); const packageJson = require('../../../package.json'); const UserSettingsStore = require('../../UserSettingsStore'); @@ -243,6 +244,12 @@ module.exports = React.createClass({ this.setState({ language: languageHandler.getCurrentLanguage(), }); + + this._sessionStore = sessionStore; + this._sessionStoreToken = this._sessionStore.addListener( + this._setStateFromSessionStore, + ); + this._setStateFromSessionStore(); }, componentDidMount: function() { @@ -269,6 +276,12 @@ module.exports = React.createClass({ } }, + _setStateFromSessionStore: function() { + this.setState({ + userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()), + }); + }, + _electronSettings: function(ev, settings) { this.setState({ electron_settings: settings }); }, @@ -1201,7 +1214,12 @@ module.exports = React.createClass({