diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 77800109e4..24db0dc995 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1676,11 +1676,6 @@ export default React.createClass({ this.showScreen("forgot_password"); }, - onReturnToAppClick: function() { - // treat it the same as if the user had completed the login - this._onLoggedIn(); - }, - // returns a promise which resolves to the new MatrixClient onRegistered: function(credentials) { // XXX: This should be in state or ideally store(s) because we risk not @@ -1936,7 +1931,6 @@ export default React.createClass({ defaultDeviceDisplayName={this.props.defaultDeviceDisplayName} onForgotPasswordClick={this.onForgotPasswordClick} enableGuest={this.props.enableGuest} - onCancelClick={MatrixClientPeg.get() ? this.onReturnToAppClick : null} onServerConfigChange={this.onServerConfigChange} /> ); diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 17da4a855f..8524447ed4 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -26,19 +26,18 @@ import Login from '../../../Login'; import SdkConfig from '../../../SdkConfig'; import { messageForResourceLimitError } from '../../../utils/ErrorUtils'; import { AutoDiscovery } from "matrix-js-sdk"; -import * as ServerType from '../../views/auth/ServerTypeSelector'; // For validating phone numbers without country codes const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/; // Phases -// Show controls to configure server details -const PHASE_SERVER_DETAILS = 0; // Show the appropriate login flow(s) for the server -const PHASE_LOGIN = 1; +const PHASE_LOGIN = 0; +// Show controls to configure server details +const PHASE_SERVER_DETAILS = 1; -// Disable phases for now, pending UX discussion on WK discovery -const PHASES_ENABLED = false; +// Enable phases for login +const PHASES_ENABLED = true; // These are used in several places, and come from the js-sdk's autodiscovery // stuff. We define them here so that they'll be picked up by i18n. @@ -77,7 +76,6 @@ module.exports = React.createClass({ // login shouldn't care how password recovery is done. onForgotPasswordClick: PropTypes.func, - onCancelClick: PropTypes.func, onServerConfigChange: PropTypes.func.isRequired, }, @@ -87,7 +85,6 @@ module.exports = React.createClass({ errorText: null, loginIncorrect: false, - serverType: null, enteredHsUrl: this.props.customHsUrl || this.props.defaultHsUrl, enteredIsUrl: this.props.customIsUrl || this.props.defaultIsUrl, @@ -97,7 +94,7 @@ module.exports = React.createClass({ phoneNumber: "", // Phase of the overall login dialog. - phase: PHASE_SERVER_DETAILS, + phase: PHASE_LOGIN, // The current login flow, such as password, SSO, etc. currentFlow: "m.login.password", @@ -263,11 +260,6 @@ module.exports = React.createClass({ username: username, discoveryError: null, }); - // If the free server type is selected, we don't show server details at all, - // so it doesn't make sense to try .well-known discovery. - if (this.state.serverType === ServerType.FREE) { - return; - } if (username[0] === "@") { const serverName = username.split(':').slice(1).join(':'); try { @@ -323,39 +315,6 @@ module.exports = React.createClass({ }); }, - onServerTypeChange(type) { - this.setState({ - serverType: type, - }); - - // When changing server types, set the HS / IS URLs to reasonable defaults for the - // the new type. - switch (type) { - case ServerType.FREE: { - const { hsUrl, isUrl } = ServerType.TYPES.FREE; - this.onServerConfigChange({ - hsUrl, - isUrl, - }); - // Move directly to the login phase since the server details are fixed. - this.setState({ - phase: PHASE_LOGIN, - }); - break; - } - case ServerType.PREMIUM: - case ServerType.ADVANCED: - this.onServerConfigChange({ - hsUrl: this.props.defaultHsUrl, - isUrl: this.props.defaultIsUrl, - }); - this.setState({ - phase: PHASE_SERVER_DETAILS, - }); - break; - } - }, - onRegisterClick: function(ev) { ev.preventDefault(); ev.stopPropagation(); @@ -391,14 +350,6 @@ module.exports = React.createClass({ try { const discovery = await AutoDiscovery.findClientConfig(serverName); - // The server type may have changed while discovery began in the background. - // If it has become the free server type which doesn't show server details, - // ignore discovery results. - if (this.state.serverType === ServerType.FREE) { - this.setState({findingHomeserver: false}); - return; - } - const state = discovery["m.homeserver"].state; if (state !== AutoDiscovery.SUCCESS && state !== AutoDiscovery.PROMPT) { this.setState({ @@ -554,51 +505,27 @@ module.exports = React.createClass({ return errorText; }, - renderServerComponentForStep() { - const ServerTypeSelector = sdk.getComponent("auth.ServerTypeSelector"); + renderServerComponent() { const ServerConfig = sdk.getComponent("auth.ServerConfig"); - const ModularServerConfig = sdk.getComponent("auth.ModularServerConfig"); const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); if (SdkConfig.get()['disable_custom_urls']) { return null; } - // If we're on a different phase, we only show the server type selector, - // which is always shown if we allow custom URLs at all. if (PHASES_ENABLED && this.state.phase !== PHASE_SERVER_DETAILS) { - return