diff --git a/src/skins/vector/views/templates/Login.js b/src/skins/vector/views/templates/Login.js index 702043c6c8..e01bd1f7e2 100644 --- a/src/skins/vector/views/templates/Login.js +++ b/src/skins/vector/views/templates/Login.js @@ -29,23 +29,22 @@ module.exports = React.createClass({ displayName: 'Login', mixins: [LoginController], - componentWillMount: function() { + getInitialState: function() { // TODO: factor out all localstorage stuff into its own home. // This is common to Login, Register and MatrixClientPeg var localStorage = window.localStorage; + var hs_url, is_url; if (localStorage) { - var hs_url = localStorage.getItem("mx_hs_url"); - var is_url = localStorage.getItem("mx_is_url"); + hs_url = localStorage.getItem("mx_hs_url"); + is_url = localStorage.getItem("mx_is_url"); } - this.setState({ + return { customHsUrl: hs_url || config.default_hs_url, customIsUrl: is_url || config.default_is_url, - serverConfigVisible: (hs_url !== config.default_hs_url || - is_url !== config.default_is_url) - }); - - this.onHSChosen(); + serverConfigVisible: (hs_url && hs_url !== config.default_hs_url || + is_url && is_url !== config.default_is_url) + } }, getHsUrl: function() { @@ -147,7 +146,7 @@ module.exports = React.createClass({ return (