Merge pull request #3218 from matrix-org/travis/check-when-dead
Check for liveliness on submission when the server was previously dead
This commit is contained in:
commit
2471f92331
1 changed files with 25 additions and 3 deletions
|
@ -145,9 +145,31 @@ module.exports = React.createClass({
|
||||||
return this.state.busy || this.props.busy;
|
return this.state.busy || this.props.busy;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordLogin: function(username, phoneCountry, phoneNumber, password) {
|
onPasswordLogin: async function(username, phoneCountry, phoneNumber, password) {
|
||||||
// Prevent people from submitting their password when something isn't right.
|
if (!this.state.serverIsAlive) {
|
||||||
if (this.isBusy()) return;
|
this.setState({busy: true});
|
||||||
|
// Do a quick liveliness check on the URLs
|
||||||
|
let aliveAgain = true;
|
||||||
|
try {
|
||||||
|
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
|
||||||
|
this.props.serverConfig.hsUrl,
|
||||||
|
this.props.serverConfig.isUrl,
|
||||||
|
);
|
||||||
|
this.setState({serverIsAlive: true, errorText: ""});
|
||||||
|
} catch (e) {
|
||||||
|
const componentState = AutoDiscoveryUtils.authComponentStateForError(e);
|
||||||
|
this.setState({
|
||||||
|
busy: false,
|
||||||
|
...componentState,
|
||||||
|
});
|
||||||
|
aliveAgain = !componentState.serverErrorIsFatal;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent people from submitting their password when something isn't right.
|
||||||
|
if (!aliveAgain) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: true,
|
busy: true,
|
||||||
|
|
Loading…
Reference in a new issue