diff --git a/src/PasswordReset.js b/src/PasswordReset.js index df51e4d846..0dd5802962 100644 --- a/src/PasswordReset.js +++ b/src/PasswordReset.js @@ -36,7 +36,11 @@ class PasswordReset { idBaseUrl: identityUrl, }); this.clientSecret = this.client.generateClientSecret(); - this.identityServerDomain = identityUrl.split("://")[1]; + this.identityServerDomain = identityUrl ? identityUrl.split("://")[1] : null; + } + + doesServerRequireIdServerParam() { + return this.client.doesServerRequireIdServerParam(); } /** diff --git a/src/components/structures/auth/ForgotPassword.js b/src/components/structures/auth/ForgotPassword.js index 0c1a8ec33d..6d80f66d64 100644 --- a/src/components/structures/auth/ForgotPassword.js +++ b/src/components/structures/auth/ForgotPassword.js @@ -62,10 +62,12 @@ module.exports = React.createClass({ serverIsAlive: true, serverErrorIsFatal: false, serverDeadError: "", + serverRequiresIdServer: null, }; }, componentWillMount: function() { + this.reset = null; this._checkServerLiveliness(this.props.serverConfig); }, @@ -83,7 +85,14 @@ module.exports = React.createClass({ serverConfig.hsUrl, serverConfig.isUrl, ); - this.setState({serverIsAlive: true}); + + const pwReset = new PasswordReset(serverConfig.hsUrl, serverConfig.isUrl); + const serverRequiresIdServer = await pwReset.doesServerRequireIdServerParam(); + + this.setState({ + serverIsAlive: true, + serverRequiresIdServer, + }); } catch (e) { this.setState(AutoDiscoveryUtils.authComponentStateForError(e, "forgot_password")); } @@ -256,7 +265,7 @@ module.exports = React.createClass({ ; } - if (!this.props.serverConfig.isUrl) { + if (!this.props.serverConfig.isUrl && this.state.serverRequiresIdServer) { return