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

Ensure elements on Login page are disabled when in-flight #12895

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/structures/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
fragmentAfterLogin={this.props.fragmentAfterLogin}
primary={!this.state.flows?.find((flow) => flow.type === "m.login.password")}
action={SSOAction.LOGIN}
disabled={this.isBusy()}
/>
);
};
Expand Down Expand Up @@ -558,6 +559,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
<ServerPicker
serverConfig={this.props.serverConfig}
onServerConfigChange={this.props.onServerConfigChange}
disabled={this.isBusy()}
/>
{this.renderLoginComponentForFlows()}
{footer}
Expand Down
12 changes: 11 additions & 1 deletion src/components/views/elements/SSOButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,20 @@ interface IProps {
fragmentAfterLogin?: string;
primary?: boolean;
action?: SSOAction;
disabled?: boolean;
}

const MAX_PER_ROW = 6;

const SSOButtons: React.FC<IProps> = ({ matrixClient, flow, loginType, fragmentAfterLogin, primary, action }) => {
const SSOButtons: React.FC<IProps> = ({
matrixClient,
flow,
loginType,
fragmentAfterLogin,
primary,
action,
disabled,
}) => {
const providers = flow.identity_providers || [];
if (providers.length < 2) {
return (
Expand All @@ -168,6 +177,7 @@ const SSOButtons: React.FC<IProps> = ({ matrixClient, flow, loginType, fragmentA
primary={primary}
action={action}
flow={flow}
disabled={disabled}
/>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/elements/ServerPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface IProps {
title?: string;
dialogTitle?: string;
serverConfig: ValidatedServerConfig;
disabled?: boolean;
onServerConfigChange?(config: ValidatedServerConfig): void;
}

Expand All @@ -55,7 +56,7 @@ const onHelpClick = (): void => {
);
};

const ServerPicker: React.FC<IProps> = ({ title, dialogTitle, serverConfig, onServerConfigChange }) => {
const ServerPicker: React.FC<IProps> = ({ title, dialogTitle, serverConfig, onServerConfigChange, disabled }) => {
const disableCustomUrls = SdkConfig.get("disable_custom_urls");

let editBtn;
Expand All @@ -68,7 +69,7 @@ const ServerPicker: React.FC<IProps> = ({ title, dialogTitle, serverConfig, onSe
});
};
editBtn = (
<AccessibleButton className="mx_ServerPicker_change" kind="link" onClick={onClick}>
<AccessibleButton className="mx_ServerPicker_change" kind="link" onClick={onClick} disabled={disabled}>
{_t("action|edit")}
</AccessibleButton>
);
Expand Down
Loading