From 9794e32f483980ca311ecbaaa9134006b486a1bf Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 11 Mar 2019 16:32:50 -0600 Subject: [PATCH 1/2] Provide an escape from the registration process Fixes https://github.com/vector-im/riot-web/issues/6560 Would be better improved by https://github.com/matrix-org/matrix-doc/pull/1921 or similar in the future. --- .../structures/auth/Registration.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index c24023803c..bbf024398d 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -366,6 +366,17 @@ module.exports = React.createClass({ this.props.onLoginClick(); }, + onGoToFormClicked(ev) { + ev.preventDefault(); + ev.stopPropagation(); + this._replaceClient(); + this.setState({ + busy: false, + doingUIAuth: false, + phase: PHASE_REGISTRATION, + }); + }, + onServerDetailsNextPhaseClick(ev) { ev.stopPropagation(); this.setState({ @@ -549,6 +560,15 @@ module.exports = React.createClass({ { _t('Sign in instead') } ; + let goBack = + { _t('Go back') } + ; + + // Don't show the 'go back' button in one specific case: when you're staring at the form. + if ((PHASES_ENABLED && this.state.phase === PHASE_REGISTRATION) && !this.state.doingUIAuth) { + goBack = null; + } + return ( @@ -557,6 +577,7 @@ module.exports = React.createClass({ { errorText } { this.renderServerComponent() } { this.renderRegisterComponent() } + { goBack } { signIn } From 9b252cace55b87fb2c08c2458a9e7bb47ce7dcfb Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 12 Mar 2019 10:39:38 -0600 Subject: [PATCH 2/2] Invert to be if(!form) goback --- src/components/structures/auth/Registration.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index bbf024398d..0d36e592f8 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -560,13 +560,12 @@ module.exports = React.createClass({ { _t('Sign in instead') } ; - let goBack = - { _t('Go back') } - ; - - // Don't show the 'go back' button in one specific case: when you're staring at the form. - if ((PHASES_ENABLED && this.state.phase === PHASE_REGISTRATION) && !this.state.doingUIAuth) { - goBack = null; + // Only show the 'go back' button if you're not looking at the form + let goBack; + if ((PHASES_ENABLED && this.state.phase !== PHASE_REGISTRATION) || this.state.doingUIAuth) { + goBack = + { _t('Go back') } + ; } return (