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

Commit 9f5b39b

Browse files
authored
Ensure elements on Login page are disabled when in-flight (#12895)
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 3f386a6 commit 9f5b39b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/components/structures/auth/Login.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
485485
fragmentAfterLogin={this.props.fragmentAfterLogin}
486486
primary={!this.state.flows?.find((flow) => flow.type === "m.login.password")}
487487
action={SSOAction.LOGIN}
488+
disabled={this.isBusy()}
488489
/>
489490
);
490491
};
@@ -558,6 +559,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
558559
<ServerPicker
559560
serverConfig={this.props.serverConfig}
560561
onServerConfigChange={this.props.onServerConfigChange}
562+
disabled={this.isBusy()}
561563
/>
562564
{this.renderLoginComponentForFlows()}
563565
{footer}

src/components/views/elements/SSOButtons.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,20 @@ interface IProps {
151151
fragmentAfterLogin?: string;
152152
primary?: boolean;
153153
action?: SSOAction;
154+
disabled?: boolean;
154155
}
155156

156157
const MAX_PER_ROW = 6;
157158

158-
const SSOButtons: React.FC<IProps> = ({ matrixClient, flow, loginType, fragmentAfterLogin, primary, action }) => {
159+
const SSOButtons: React.FC<IProps> = ({
160+
matrixClient,
161+
flow,
162+
loginType,
163+
fragmentAfterLogin,
164+
primary,
165+
action,
166+
disabled,
167+
}) => {
159168
const providers = flow.identity_providers || [];
160169
if (providers.length < 2) {
161170
return (
@@ -168,6 +177,7 @@ const SSOButtons: React.FC<IProps> = ({ matrixClient, flow, loginType, fragmentA
168177
primary={primary}
169178
action={action}
170179
flow={flow}
180+
disabled={disabled}
171181
/>
172182
</div>
173183
);

src/components/views/elements/ServerPicker.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface IProps {
2929
title?: string;
3030
dialogTitle?: string;
3131
serverConfig: ValidatedServerConfig;
32+
disabled?: boolean;
3233
onServerConfigChange?(config: ValidatedServerConfig): void;
3334
}
3435

@@ -55,7 +56,7 @@ const onHelpClick = (): void => {
5556
);
5657
};
5758

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

6162
let editBtn;
@@ -68,7 +69,7 @@ const ServerPicker: React.FC<IProps> = ({ title, dialogTitle, serverConfig, onSe
6869
});
6970
};
7071
editBtn = (
71-
<AccessibleButton className="mx_ServerPicker_change" kind="link" onClick={onClick}>
72+
<AccessibleButton className="mx_ServerPicker_change" kind="link" onClick={onClick} disabled={disabled}>
7273
{_t("action|edit")}
7374
</AccessibleButton>
7475
);

0 commit comments

Comments
 (0)