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.
This commit is contained in:
Travis Ralston 2019-03-11 16:32:50 -06:00
parent 1165c51c77
commit 9794e32f48

View File

@ -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') }
</a>;
let goBack = <a className="mx_AuthBody_changeFlow" onClick={this.onGoToFormClicked} href="#">
{ _t('Go back') }
</a>;
// 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 (
<AuthPage>
<AuthHeader />
@ -557,6 +577,7 @@ module.exports = React.createClass({
{ errorText }
{ this.renderServerComponent() }
{ this.renderRegisterComponent() }
{ goBack }
{ signIn }
</AuthBody>
</AuthPage>