From ac26719b691493e339f2da7c1cf3367a14d464c5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 15 Apr 2020 14:07:37 +0100 Subject: [PATCH] disable password reset button when spinning Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/structures/auth/_Login.scss | 10 ++++++++++ src/components/structures/auth/Login.js | 2 +- src/components/views/auth/PasswordLogin.js | 21 +++++++++++++-------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/res/css/structures/auth/_Login.scss b/res/css/structures/auth/_Login.scss index 4ce90cc6bd..02436833a2 100644 --- a/res/css/structures/auth/_Login.scss +++ b/res/css/structures/auth/_Login.scss @@ -89,3 +89,13 @@ limitations under the License. .mx_Login_underlinedServerName { border-bottom: 1px dashed $accent-color; } + +div.mx_AccessibleButton_kind_link.mx_Login_forgot { + // style it as a link + font-size: inherit; + padding: 0; + + &.mx_AccessibleButton_disabled { + cursor: not-allowed; + } +} diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 93c93fd5ab..851ea30ba0 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -599,7 +599,7 @@ export default createReactClass({ loginIncorrect={this.state.loginIncorrect} serverConfig={this.props.serverConfig} disableSubmit={this.isBusy()} - hideSubmit={this.props.isSyncing || this.state.busyLoggingIn} + busy={this.props.isSyncing || this.state.busyLoggingIn} /> ); }, diff --git a/src/components/views/auth/PasswordLogin.js b/src/components/views/auth/PasswordLogin.js index d27e4a8259..aeaa91845b 100644 --- a/src/components/views/auth/PasswordLogin.js +++ b/src/components/views/auth/PasswordLogin.js @@ -23,6 +23,7 @@ import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import SdkConfig from '../../../SdkConfig'; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; +import AccessibleButton from "../elements/AccessibleButton"; /** * A pure UI component which displays a username/password form. @@ -43,8 +44,8 @@ export default class PasswordLogin extends React.Component { onPasswordChanged: PropTypes.func, loginIncorrect: PropTypes.bool, disableSubmit: PropTypes.bool, - hideSubmit: PropTypes.bool, serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired, + busy: PropTypes.bool, }; static defaultProps = { @@ -266,12 +267,16 @@ export default class PasswordLogin extends React.Component { if (this.props.onForgotPasswordClick) { forgotPasswordJsx = {_t('Not sure of your password? Set a new one', {}, { - a: sub => - {sub} - , + a: sub => ( + + {sub} + + ), })} ; } @@ -333,7 +338,7 @@ export default class PasswordLogin extends React.Component { disabled={this.props.disableSubmit} /> {forgotPasswordJsx} - { !this.props.hideSubmit &&