From 41a9db32242ebf422bd8a725df08af4b9adbd2c1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 16 Aug 2019 15:07:15 +0100 Subject: [PATCH] Use new flag in /versions --- src/components/structures/auth/Registration.js | 15 +++++++-------- src/components/views/auth/RegistrationForm.js | 5 ++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 0d3fe29967..af51ca7df0 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -98,8 +98,8 @@ module.exports = React.createClass({ // component without it. matrixClient: null, - // the capabilities object from the server - serverCaps: null, + // whether the HS requires an ID server to register with a threepid + serverRequiresIdServer: null, // The user ID we've just registered registeredUsername: null, @@ -212,17 +212,16 @@ module.exports = React.createClass({ idBaseUrl: isUrl, }); - let caps = null; + let serverRequiresIdServer = true; try { - caps = await cli.getServerCapabilities(); - caps = caps || {}; + serverRequiresIdServer = await cli.doesServerRequireIdServerParam(); } catch (e) { - console.log("Unable to fetch server capabilities", e); + console.log("Unable to determine is server needs id_server param", e); } this.setState({ matrixClient: cli, - serverCaps: caps, + serverRequiresIdServer, busy: false, }); try { @@ -564,7 +563,7 @@ module.exports = React.createClass({ flows={this.state.flows} serverConfig={this.props.serverConfig} canSubmit={!this.state.serverErrorIsFatal} - serverCapabilities={this.state.serverCaps} + serverRequiresIdServer={this.state.serverRequiresIdServer} />; } }, diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index 368ab599e3..cf1b074fe1 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -55,7 +55,7 @@ module.exports = React.createClass({ flows: PropTypes.arrayOf(PropTypes.object).isRequired, serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired, canSubmit: PropTypes.bool, - serverCapabilities: PropTypes.object, + serverRequiresIdServer: PropTypes.bool, }, getDefaultProps: function() { @@ -437,9 +437,8 @@ module.exports = React.createClass({ }, _showEmail() { - const idServerRequired = !this.props.serverCapabilities['me.dbkr.idomyownemail']; const haveIs = Boolean(this.props.serverConfig.isUrl); - if ((idServerRequired && !haveIs) || !this._authStepIsUsed('m.login.email.identity')) { + if ((this.props.serverRequiresIdServer && !haveIs) || !this._authStepIsUsed('m.login.email.identity')) { return false; } return true;