mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-29 10:28:08 +00:00
Fixed passphrase checkbox
This commit is contained in:
parent
ea391a2a00
commit
a1cf6cc296
@ -161,24 +161,18 @@ class Passphrase extends PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleCheckboxClick() {
|
handleCheckboxClick() {
|
||||||
// If passphrase was visible and now shouldn't be --> delete the value of passphraseCheckInputValue
|
let match = false;
|
||||||
// doPassphraseInputsMatch
|
|
||||||
// - if passphrase was visible and now shouldn't be --> doPassphraseInputsMatch = false
|
|
||||||
// - because passphraseCheckInputValue will be empty string
|
|
||||||
// - if passphrase wasn't visibe and now should be --> doPassphraseInputsMatch = true
|
|
||||||
// - because passphraseCheckInputValue will be same as passphraseInputValue
|
|
||||||
let doInputsMatch = false;
|
|
||||||
if (this.state.shouldShowSingleInput || this.state.passphraseInputValue === this.state.passphraseCheckInputValue) {
|
if (this.state.shouldShowSingleInput || this.state.passphraseInputValue === this.state.passphraseCheckInputValue) {
|
||||||
doInputsMatch = true;
|
match = true;
|
||||||
} else {
|
} else {
|
||||||
doInputsMatch = !!this.state.isPassphraseHidden;
|
match = !!this.state.isPassphraseHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState(previousState => ({
|
this.setState(previousState => ({
|
||||||
isPassphraseHidden: !previousState.isPassphraseHidden,
|
isPassphraseHidden: !previousState.isPassphraseHidden,
|
||||||
passphraseInputValue: previousState.isPassphraseHidden ? previousState.passphraseInputValue : '',
|
passphraseInputValue: previousState.passphraseInputValue,
|
||||||
passphraseCheckInputValue: previousState.isPassphraseHidden ? previousState.passphraseInputValue : '',
|
passphraseCheckInputValue: previousState.passphraseCheckInputValue,
|
||||||
doPassphraseInputsMatch: doInputsMatch,
|
doPassphraseInputsMatch: match,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,11 +233,9 @@ class Passphrase extends PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!this.state.doPassphraseInputsMatch && (
|
{!this.state.doPassphraseInputsMatch && (
|
||||||
<PassphraseError>Passphrases do not match</PassphraseError>
|
<PassphraseError>Passphrases do not match</PassphraseError>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
isChecked={!this.state.isPassphraseHidden}
|
isChecked={!this.state.isPassphraseHidden}
|
||||||
@ -259,10 +251,8 @@ class Passphrase extends PureComponent<Props, State> {
|
|||||||
>Enter
|
>Enter
|
||||||
</Button>
|
</Button>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Footer>
|
<Footer>
|
||||||
<P isSmaller>
|
<P isSmaller>Changed your mind?
|
||||||
Changed your mind?
|
|
||||||
<LinkButton
|
<LinkButton
|
||||||
isGreen
|
isGreen
|
||||||
onClick={() => this.submitPassphrase(true)}
|
onClick={() => this.submitPassphrase(true)}
|
||||||
|
Loading…
Reference in New Issue
Block a user