diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index 6dcbfe7e47..bfaab8fdb8 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -94,6 +94,7 @@ module.exports = React.createClass({ discoveredHsUrl: "", discoveredIsUrl: "", discoveryError: "", + findingHomeserver: false, }; }, @@ -299,10 +300,11 @@ module.exports = React.createClass({ _tryWellKnownDiscovery: async function(serverName) { if (!serverName.trim()) { // Nothing to discover - this.setState({discoveryError: "", discoveredHsUrl: "", discoveredIsUrl: ""}); + this.setState({discoveryError: "", discoveredHsUrl: "", discoveredIsUrl: "", findingHomeserver: false}); return; } + this.setState({findingHomeserver: true}); try { const discovery = await AutoDiscovery.findClientConfig(serverName); const state = discovery["m.homeserver"].state; @@ -311,12 +313,14 @@ module.exports = React.createClass({ discoveredHsUrl: "", discoveredIsUrl: "", discoveryError: discovery["m.homeserver"].error, + findingHomeserver: false, }); } else if (state === AutoDiscovery.PROMPT) { this.setState({ discoveredHsUrl: "", discoveredIsUrl: "", discoveryError: "", + findingHomeserver: false, }); } else if (state === AutoDiscovery.SUCCESS) { this.setState({ @@ -326,6 +330,7 @@ module.exports = React.createClass({ ? discovery["m.identity_server"].base_url : "", discoveryError: "", + findingHomeserver: false, }); } else { console.warn("Unknown state for m.homeserver in discovery response: ", discovery); @@ -333,6 +338,7 @@ module.exports = React.createClass({ discoveredHsUrl: "", discoveredIsUrl: "", discoveryError: _t("Unknown failure discovering homeserver"), + findingHomeserver: false, }); } } catch (e) { @@ -485,6 +491,7 @@ module.exports = React.createClass({ loginIncorrect={this.state.loginIncorrect} hsUrl={this.state.enteredHomeserverUrl} hsName={this.props.defaultServerName} + disableSubmit={this.state.findingHomeserver} /> ); }, diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js index 04aaae3630..59d4db379c 100644 --- a/src/components/views/login/PasswordLogin.js +++ b/src/components/views/login/PasswordLogin.js @@ -41,6 +41,7 @@ class PasswordLogin extends React.Component { loginIncorrect: false, hsDomain: "", hsName: null, + disableSubmit: false, } constructor(props) { @@ -291,6 +292,8 @@ class PasswordLogin extends React.Component { ); } + const disableSubmit = this.props.disableSubmit || matrixIdText === ''; + return (