disabled submit button be disabled

This commit is contained in:
Michael Telatynski 2020-02-09 15:07:07 +00:00
parent 2230e746aa
commit 74af4fd764

View file

@ -67,7 +67,9 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
}); });
} }
_onPassPhraseNext = async () => { _onPassPhraseNext = async (e) => {
e.preventDefault();
if (this.state.passPhrase.length <= 0) return; if (this.state.passPhrase.length <= 0) return;
this.setState({ keyMatches: null }); this.setState({ keyMatches: null });
@ -80,7 +82,9 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
} }
} }
_onRecoveryKeyNext = async () => { _onRecoveryKeyNext = async (e) => {
e.preventDefault();
if (!this.state.recoveryKeyValid) return; if (!this.state.recoveryKeyValid) return;
this.setState({ keyMatches: null }); this.setState({ keyMatches: null });
@ -140,7 +144,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
"identity for verifying other sessions by entering your passphrase.", "identity for verifying other sessions by entering your passphrase.",
)}</p> )}</p>
<form className="mx_AccessSecretStorageDialog_primaryContainer"> <form className="mx_AccessSecretStorageDialog_primaryContainer" onSubmit={this._onPassPhraseNext}>
<input <input
type="password" type="password"
className="mx_AccessSecretStorageDialog_passPhraseInput" className="mx_AccessSecretStorageDialog_passPhraseInput"
@ -156,7 +160,6 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
hasCancel={true} hasCancel={true}
onCancel={this._onCancel} onCancel={this._onCancel}
focus={false} focus={false}
primaryIsSubmit={true}
primaryDisabled={this.state.passPhrase.length === 0} primaryDisabled={this.state.passPhrase.length === 0}
/> />
</form> </form>
@ -215,7 +218,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
"identity for verifying other sessions by entering your recovery key.", "identity for verifying other sessions by entering your recovery key.",
)}</p> )}</p>
<form className="mx_AccessSecretStorageDialog_primaryContainer"> <form className="mx_AccessSecretStorageDialog_primaryContainer" onSubmit={this._onRecoveryKeyNext}>
<input className="mx_AccessSecretStorageDialog_recoveryKeyInput" <input className="mx_AccessSecretStorageDialog_recoveryKeyInput"
onChange={this._onRecoveryKeyChange} onChange={this._onRecoveryKeyChange}
value={this.state.recoveryKey} value={this.state.recoveryKey}
@ -228,7 +231,6 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
hasCancel={true} hasCancel={true}
onCancel={this._onCancel} onCancel={this._onCancel}
focus={false} focus={false}
primaryIsSubmit={true}
primaryDisabled={!this.state.recoveryKeyValid} primaryDisabled={!this.state.recoveryKeyValid}
/> />
</form> </form>