From fe141412b64d7d16fd68812372363b052d67a85f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 21 Feb 2019 18:02:00 +0000 Subject: [PATCH] Skip server details on registration with a default HS If Riot has been configured with a `default_hs_url` (or `default_server_name`, which then sets a default HS URL), then skip the server details on registration by default. Fixes https://github.com/vector-im/riot-web/issues/8840 --- src/components/structures/MatrixChat.js | 12 ++++++++++++ src/components/structures/auth/Registration.js | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 7de4141192..6fc2cb073d 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -245,6 +245,17 @@ export default React.createClass({ return this.state.defaultIsUrl || "https://vector.im"; }, + /** + * Whether to skip the server details phase of registration and start at the + * actual form. + * @return {boolean} + * If there was a configured default HS or default server name, skip the + * the server details. + */ + skipServerDetailsForRegistration() { + return !!this.state.defaultHsUrl; + }, + componentWillMount: function() { SdkConfig.put(this.props.config); @@ -1891,6 +1902,7 @@ export default React.createClass({ defaultServerDiscoveryError={this.state.defaultServerDiscoveryError} defaultHsUrl={this.getDefaultHsUrl()} defaultIsUrl={this.getDefaultIsUrl()} + skipServerDetails={this.skipServerDetailsForRegistration()} brand={this.props.config.brand} customHsUrl={this.getCurrentHsUrl()} customIsUrl={this.getCurrentIsUrl()} diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 30b553a5b1..6431431640 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -60,6 +60,7 @@ module.exports = React.createClass({ customIsUrl: PropTypes.string, defaultHsUrl: PropTypes.string, defaultIsUrl: PropTypes.string, + skipServerDetails: PropTypes.bool, brand: PropTypes.string, email: PropTypes.string, // registration shouldn't know or care how login is done. @@ -75,8 +76,10 @@ module.exports = React.createClass({ // (they could come in from the URL params in a // registration email link) (this.props.clientSecret && this.props.sessionId) || - // or if custom URLs aren't allowed, skip them - !customURLsAllowed + // if custom URLs aren't allowed, skip to form + !customURLsAllowed || + // if other logic says to, skip to form + this.props.skipServerDetails ) { initialPhase = PHASE_REGISTRATION; }