disable password reset button when spinning

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-04-15 14:07:37 +01:00
parent 8b25223026
commit ac26719b69
3 changed files with 24 additions and 9 deletions

View File

@ -89,3 +89,13 @@ limitations under the License.
.mx_Login_underlinedServerName { .mx_Login_underlinedServerName {
border-bottom: 1px dashed $accent-color; 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;
}
}

View File

@ -599,7 +599,7 @@ export default createReactClass({
loginIncorrect={this.state.loginIncorrect} loginIncorrect={this.state.loginIncorrect}
serverConfig={this.props.serverConfig} serverConfig={this.props.serverConfig}
disableSubmit={this.isBusy()} disableSubmit={this.isBusy()}
hideSubmit={this.props.isSyncing || this.state.busyLoggingIn} busy={this.props.isSyncing || this.state.busyLoggingIn}
/> />
); );
}, },

View File

@ -23,6 +23,7 @@ import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils"; import {ValidatedServerConfig} from "../../../utils/AutoDiscoveryUtils";
import AccessibleButton from "../elements/AccessibleButton";
/** /**
* A pure UI component which displays a username/password form. * A pure UI component which displays a username/password form.
@ -43,8 +44,8 @@ export default class PasswordLogin extends React.Component {
onPasswordChanged: PropTypes.func, onPasswordChanged: PropTypes.func,
loginIncorrect: PropTypes.bool, loginIncorrect: PropTypes.bool,
disableSubmit: PropTypes.bool, disableSubmit: PropTypes.bool,
hideSubmit: PropTypes.bool,
serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired, serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired,
busy: PropTypes.bool,
}; };
static defaultProps = { static defaultProps = {
@ -266,12 +267,16 @@ export default class PasswordLogin extends React.Component {
if (this.props.onForgotPasswordClick) { if (this.props.onForgotPasswordClick) {
forgotPasswordJsx = <span> forgotPasswordJsx = <span>
{_t('Not sure of your password? <a>Set a new one</a>', {}, { {_t('Not sure of your password? <a>Set a new one</a>', {}, {
a: sub => <a className="mx_Login_forgot" a: sub => (
onClick={this.onForgotPasswordClick} <AccessibleButton
href="#" className="mx_Login_forgot"
> disabled={this.props.busy}
{sub} kind="link"
</a>, onClick={this.onForgotPasswordClick}
>
{sub}
</AccessibleButton>
),
})} })}
</span>; </span>;
} }
@ -333,7 +338,7 @@ export default class PasswordLogin extends React.Component {
disabled={this.props.disableSubmit} disabled={this.props.disableSubmit}
/> />
{forgotPasswordJsx} {forgotPasswordJsx}
{ !this.props.hideSubmit && <input className="mx_Login_submit" { !this.props.busy && <input className="mx_Login_submit"
type="submit" type="submit"
value={_t('Sign in')} value={_t('Sign in')}
disabled={this.props.disableSubmit} disabled={this.props.disableSubmit}