From 9f5b39b9d951348b102c5c04b29c83555fdbe39e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 17 Aug 2024 10:37:35 +0100 Subject: [PATCH] Ensure elements on Login page are disabled when in-flight (#12895) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/auth/Login.tsx | 2 ++ src/components/views/elements/SSOButtons.tsx | 12 +++++++++++- src/components/views/elements/ServerPicker.tsx | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index 5fadde7cbe..16f04f84d6 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -485,6 +485,7 @@ export default class LoginComponent extends React.PureComponent fragmentAfterLogin={this.props.fragmentAfterLogin} primary={!this.state.flows?.find((flow) => flow.type === "m.login.password")} action={SSOAction.LOGIN} + disabled={this.isBusy()} /> ); }; @@ -558,6 +559,7 @@ export default class LoginComponent extends React.PureComponent {this.renderLoginComponentForFlows()} {footer} diff --git a/src/components/views/elements/SSOButtons.tsx b/src/components/views/elements/SSOButtons.tsx index c0647e504f..be795ee50a 100644 --- a/src/components/views/elements/SSOButtons.tsx +++ b/src/components/views/elements/SSOButtons.tsx @@ -151,11 +151,20 @@ interface IProps { fragmentAfterLogin?: string; primary?: boolean; action?: SSOAction; + disabled?: boolean; } const MAX_PER_ROW = 6; -const SSOButtons: React.FC = ({ matrixClient, flow, loginType, fragmentAfterLogin, primary, action }) => { +const SSOButtons: React.FC = ({ + matrixClient, + flow, + loginType, + fragmentAfterLogin, + primary, + action, + disabled, +}) => { const providers = flow.identity_providers || []; if (providers.length < 2) { return ( @@ -168,6 +177,7 @@ const SSOButtons: React.FC = ({ matrixClient, flow, loginType, fragmentA primary={primary} action={action} flow={flow} + disabled={disabled} /> ); diff --git a/src/components/views/elements/ServerPicker.tsx b/src/components/views/elements/ServerPicker.tsx index c6f505e804..fd489bd67b 100644 --- a/src/components/views/elements/ServerPicker.tsx +++ b/src/components/views/elements/ServerPicker.tsx @@ -29,6 +29,7 @@ interface IProps { title?: string; dialogTitle?: string; serverConfig: ValidatedServerConfig; + disabled?: boolean; onServerConfigChange?(config: ValidatedServerConfig): void; } @@ -55,7 +56,7 @@ const onHelpClick = (): void => { ); }; -const ServerPicker: React.FC = ({ title, dialogTitle, serverConfig, onServerConfigChange }) => { +const ServerPicker: React.FC = ({ title, dialogTitle, serverConfig, onServerConfigChange, disabled }) => { const disableCustomUrls = SdkConfig.get("disable_custom_urls"); let editBtn; @@ -68,7 +69,7 @@ const ServerPicker: React.FC = ({ title, dialogTitle, serverConfig, onSe }); }; editBtn = ( - + {_t("action|edit")} );