mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-09 15:40:55 +00:00
Merge pull request #479 from trezor/fix/signverify-validation
Fix/signverify validation
This commit is contained in:
commit
263e09dad1
@ -141,12 +141,16 @@ const inputChange = (inputName: string, value: string): ThunkAction => (
|
|||||||
type: SIGN_VERIFY.TOUCH,
|
type: SIGN_VERIFY.TOUCH,
|
||||||
inputName,
|
inputName,
|
||||||
});
|
});
|
||||||
if (inputName === 'verifyAddress' && validateAddress(value) !== null) {
|
|
||||||
dispatch({
|
if (inputName === 'verifyAddress') {
|
||||||
type: SIGN_VERIFY.ERROR,
|
const error = validateAddress(value);
|
||||||
inputName,
|
if (error) {
|
||||||
message: validateAddress(value),
|
dispatch({
|
||||||
});
|
type: SIGN_VERIFY.ERROR,
|
||||||
|
inputName,
|
||||||
|
message: error,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ export default (state: State = initialState, action: Action): State => {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
touched: [...state.touched, action.inputName],
|
touched: [...state.touched, action.inputName],
|
||||||
|
// reset errors for the input even if it was not touched before
|
||||||
|
errors: state.errors.filter(error => error.inputName !== inputName),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -140,6 +140,7 @@ class SignVerify extends Component<Props> {
|
|||||||
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
|
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
|
isDisabled={!device.connected}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
signVerifyActions.sign(account.accountPath, signMessage)
|
signVerifyActions.sign(account.accountPath, signMessage)
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ class SignVerify extends Component<Props> {
|
|||||||
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
|
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
isDisabled={!!verifyAddressError}
|
isDisabled={!!verifyAddressError || !device.connected}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (errors.length <= 0) {
|
if (errors.length <= 0) {
|
||||||
signVerifyActions.verify(
|
signVerifyActions.verify(
|
||||||
|
Loading…
Reference in New Issue
Block a user