Don't handle identity server failure as fatal, and use the right message
Fixes https://github.com/vector-im/riot-web/issues/10002
This commit is contained in:
parent
a47a46bd9f
commit
aacb942d57
7 changed files with 81 additions and 15 deletions
|
@ -23,6 +23,7 @@ import Modal from "../../../Modal";
|
|||
import SdkConfig from "../../../SdkConfig";
|
||||
import PasswordReset from "../../../PasswordReset";
|
||||
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
||||
import classNames from 'classnames';
|
||||
|
||||
// Phases
|
||||
// Show controls to configure server details
|
||||
|
@ -59,6 +60,7 @@ module.exports = React.createClass({
|
|||
// that we can render it differently, and override any other error the user may
|
||||
// be seeing.
|
||||
serverIsAlive: true,
|
||||
serverErrorIsFatal: false,
|
||||
serverDeadError: "",
|
||||
};
|
||||
},
|
||||
|
@ -83,7 +85,7 @@ module.exports = React.createClass({
|
|||
);
|
||||
this.setState({serverIsAlive: true});
|
||||
} catch (e) {
|
||||
this.setState(AutoDiscoveryUtils.authComponentStateForError(e));
|
||||
this.setState(AutoDiscoveryUtils.authComponentStateForError(e, "forgot_password"));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -120,6 +122,7 @@ module.exports = React.createClass({
|
|||
onSubmitForm: async function(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
// refresh the server errors, just in case the server cam back online
|
||||
await this._checkServerLiveliness(this.props.serverConfig);
|
||||
|
||||
if (!this.state.email) {
|
||||
|
@ -213,8 +216,13 @@ module.exports = React.createClass({
|
|||
|
||||
let serverDeadSection;
|
||||
if (!this.state.serverIsAlive) {
|
||||
const classes = classNames({
|
||||
"mx_Login_error": true,
|
||||
"mx_Login_serverError": true,
|
||||
"mx_Login_serverErrorNonFatal": !this.state.serverErrorIsFatal,
|
||||
});
|
||||
serverDeadSection = (
|
||||
<div className="mx_Login_error mx_Login_serverError">
|
||||
<div className={classes}>
|
||||
{this.state.serverDeadError}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -26,6 +26,7 @@ import Login from '../../../Login';
|
|||
import SdkConfig from '../../../SdkConfig';
|
||||
import { messageForResourceLimitError } from '../../../utils/ErrorUtils';
|
||||
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
||||
import classNames from "classnames";
|
||||
|
||||
// For validating phone numbers without country codes
|
||||
const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/;
|
||||
|
@ -100,6 +101,7 @@ module.exports = React.createClass({
|
|||
// that we can render it differently, and override any other error the user may
|
||||
// be seeing.
|
||||
serverIsAlive: true,
|
||||
serverErrorIsFatal: false,
|
||||
serverDeadError: "",
|
||||
};
|
||||
},
|
||||
|
@ -349,7 +351,9 @@ module.exports = React.createClass({
|
|||
busy: false,
|
||||
...AutoDiscoveryUtils.authComponentStateForError(e),
|
||||
});
|
||||
return; // Server is dead - do not continue.
|
||||
if (this.state.serverErrorIsFatal) {
|
||||
return; // Server is dead - do not continue.
|
||||
}
|
||||
}
|
||||
|
||||
loginLogic.getFlows().then((flows) => {
|
||||
|
@ -561,8 +565,13 @@ module.exports = React.createClass({
|
|||
|
||||
let serverDeadSection;
|
||||
if (!this.state.serverIsAlive) {
|
||||
const classes = classNames({
|
||||
"mx_Login_error": true,
|
||||
"mx_Login_serverError": true,
|
||||
"mx_Login_serverErrorNonFatal": !this.state.serverErrorIsFatal,
|
||||
});
|
||||
serverDeadSection = (
|
||||
<div className="mx_Login_error mx_Login_serverError">
|
||||
<div className={classes}>
|
||||
{this.state.serverDeadError}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -27,6 +27,7 @@ import SdkConfig from '../../../SdkConfig';
|
|||
import { messageForResourceLimitError } from '../../../utils/ErrorUtils';
|
||||
import * as ServerType from '../../views/auth/ServerTypeSelector';
|
||||
import AutoDiscoveryUtils, {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
|
||||
import classNames from "classnames";
|
||||
|
||||
// Phases
|
||||
// Show controls to configure server details
|
||||
|
@ -85,6 +86,7 @@ module.exports = React.createClass({
|
|||
// that we can render it differently, and override any other error the user may
|
||||
// be seeing.
|
||||
serverIsAlive: true,
|
||||
serverErrorIsFatal: false,
|
||||
serverDeadError: "",
|
||||
};
|
||||
},
|
||||
|
@ -168,8 +170,10 @@ module.exports = React.createClass({
|
|||
);
|
||||
this.setState({serverIsAlive: true});
|
||||
} catch (e) {
|
||||
this.setState(AutoDiscoveryUtils.authComponentStateForError(e));
|
||||
return; // Server is dead - do not continue.
|
||||
this.setState(AutoDiscoveryUtils.authComponentStateForError(e, "register"));
|
||||
if (this.state.serverErrorIsFatal) {
|
||||
return; // Server is dead - do not continue.
|
||||
}
|
||||
}
|
||||
|
||||
const {hsUrl, isUrl} = serverConfig;
|
||||
|
@ -467,7 +471,7 @@ module.exports = React.createClass({
|
|||
onEditServerDetailsClick={onEditServerDetailsClick}
|
||||
flows={this.state.flows}
|
||||
serverConfig={this.props.serverConfig}
|
||||
canSubmit={this.state.serverIsAlive}
|
||||
canSubmit={this.state.serverIsAlive && this.state.serverErrorIsFatal}
|
||||
/>;
|
||||
}
|
||||
},
|
||||
|
@ -485,8 +489,13 @@ module.exports = React.createClass({
|
|||
|
||||
let serverDeadSection;
|
||||
if (!this.state.serverIsAlive) {
|
||||
const classes = classNames({
|
||||
"mx_Login_error": true,
|
||||
"mx_Login_serverError": true,
|
||||
"mx_Login_serverErrorNonFatal": !this.state.serverErrorIsFatal,
|
||||
});
|
||||
serverDeadSection = (
|
||||
<div className="mx_Login_error mx_Login_serverError">
|
||||
<div className={classes}>
|
||||
{this.state.serverDeadError}
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue