diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 7818496e71..a25b532447 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -243,10 +243,15 @@ export default createReactClass({ }); }; try { - await this._makeRegisterRequest({}); - // This should never succeed since we specified an empty - // auth object. - console.log("Expecting 401 from register request but got success!"); + // We do the first registration request ourselves to discover whether we need to + // do SSO instead. If we've already started the UI Auth process though, we don't + // need to. + if (!this.state.doingUIAuth) { + await this._makeRegisterRequest({}); + // This should never succeed since we specified an empty + // auth object. + console.log("Expecting 401 from register request but got success!"); + } } catch (e) { if (e.httpStatus === 401) { this.setState({ diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index 327451be17..655452fcee 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -412,14 +412,14 @@ export const EmailIdentityAuthEntry = createReactClass({ this.props.onPhaseChange(DEFAULT_PHASE); }, - getInitialState: function() { - return { - requestingToken: false, - }; - }, - render: function() { - if (this.state.requestingToken) { + // This component is now only displayed once the token has been requested, + // so we know the email has been sent. It can also get loaded after the user + // has clicked the validation link if the server takes a while to propagate + // the validation internally. If we're in the session spawned from clicking + // the validation link, we won't know the email address, so if we don't have it, + // assume that the link has been clicked and the server will realise when we poll. + if (this.props.inputs.emailAddress === undefined) { const Loader = sdk.getComponent("elements.Spinner"); return ; } else {