Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Provide an escape from the registration process
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#6560

Would be better improved by matrix-org/matrix-spec-proposals#1921 or similar in the future.
  • Loading branch information
turt2live committed Mar 11, 2019
1 parent 1165c51 commit 9794e32
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/structures/auth/Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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 />
Expand All @@ -557,6 +577,7 @@ module.exports = React.createClass({
{ errorText }
{ this.renderServerComponent() }
{ this.renderRegisterComponent() }
{ goBack }
{ signIn }
</AuthBody>
</AuthPage>
Expand Down

0 comments on commit 9794e32

Please sign in to comment.