diff --git a/src/components/structures/InteractiveAuth.tsx b/src/components/structures/InteractiveAuth.tsx index 869cd29cba..970ea26309 100644 --- a/src/components/structures/InteractiveAuth.tsx +++ b/src/components/structures/InteractiveAuth.tsx @@ -84,7 +84,7 @@ interface IState { stageState?: IStageStatus; busy: boolean; errorText?: string; - stageErrorText?: string; + errorCode?: string; submitButtonEnabled: boolean; } @@ -103,7 +103,7 @@ export default class InteractiveAuthComponent extends React.Component { if (oldStage !== stageType) { this.setFocus(); @@ -208,7 +210,7 @@ export default class InteractiveAuthComponent extends React.Component { + this.props.onAuthFinished(false, e); + }; + + private setEmailSid = (sid: string): void => { + this.authLogic.setEmailSid(sid); + }; + + render() { const stage = this.state.authStage; if (!stage) { if (this.state.busy) { @@ -255,7 +265,8 @@ export default class InteractiveAuthComponent extends React.Component ); } - - private onAuthStageFailed = (e: Error): void => { - this.props.onAuthFinished(false, e); - }; - - private setEmailSid = (sid: string): void => { - this.authLogic.setEmailSid(sid); - }; - - render() { - let error = null; - if (this.state.errorText) { - error = ( -
- { this.state.errorText } -
- ); - } - - return ( -
-
- { this.renderCurrentStage() } - { error } -
-
- ); - } } diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.tsx b/src/components/views/auth/InteractiveAuthEntryComponents.tsx index 5544810a03..53eef7031c 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.tsx +++ b/src/components/views/auth/InteractiveAuthEntryComponents.tsx @@ -41,7 +41,7 @@ import { logger } from "matrix-js-sdk/src/logger"; * * matrixClient: A matrix client. May be a different one to the one * currently being used generally (eg. to register with - * one HS whilst beign a guest on another). + * one HS whilst being a guest on another). * loginType: the login type of the auth stage being attempted * authSessionId: session id from the server * clientSecret: The client secret in use for identity server auth sessions @@ -84,6 +84,7 @@ interface IAuthEntryProps { loginType: string; authSessionId: string; errorText?: string; + errorCode?: string; // Is the auth logic currently waiting for something to happen? busy?: boolean; onPhaseChange: (phase: number) => void; @@ -427,18 +428,29 @@ export class EmailIdentityAuthEntry extends React.Component + { this.props.errorText } + + ); + } + // 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) { - return ; - } else if (this.props.stageState?.emailSid) { - // we only have a session ID if the user has clicked the link in their email, - // so show a loading state instead of "an email has been sent to..." because - // that's confusing when you've already read that email. + // We only have a session ID if the user has clicked the link in their email, + // so show a loading state instead of "an email has been sent to..." because + // that's confusing when you've already read that email. + if (this.props.inputs.emailAddress === undefined || this.props.stageState?.emailSid) { + if (errorSection) { + return errorSection; + } return ; } else { return ( @@ -448,6 +460,7 @@ export class EmailIdentityAuthEntry extends React.Component

{ _t("Open the link in the email to continue registration.") }

+ { errorSection } ); }