mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Check for liveliness on submission when the server was previously dead
Fixes https://github.com/vector-im/riot-web/issues/10017 Specifically the `return` at the end of the diff fixes the problem, but it seems worthwhile to check for liveliness when we know the server has been dead in previous attempts.
This commit is contained in:
parent
380639516b
commit
c6a18b11f0
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) {
|
||||||
|
if (!this.state.serverIsAlive) {
|
||||||
|
this.setState({busy: true});
|
||||||
|
// Do a quick liveliness check on the URLs
|
||||||
|
try {
|
||||||
|
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
|
||||||
|
this.props.serverConfig.hsUrl,
|
||||||
|
this.props.serverConfig.isUrl,
|
||||||
|
);
|
||||||
|
this.setState({serverIsAlive: true, errorText: ""});
|
||||||
|
} catch (e) {
|
||||||
|
this.setState({
|
||||||
|
busy: false,
|
||||||
|
...AutoDiscoveryUtils.authComponentStateForError(e),
|
||||||
|
});
|
||||||
|
if (this.state.serverErrorIsFatal) {
|
||||||
|
return; // Server is dead - do not continue.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent people from submitting their password when something isn't right.
|
// Prevent people from submitting their password when something isn't right.
|
||||||
if (this.isBusy()) return;
|
if (!this.state.serverIsAlive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: true,
|
busy: true,
|
||||||
|
|
Loading…
Reference in a new issue