1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-07 14:50:52 +00:00

Merge pull request #479 from trezor/fix/signverify-validation

Fix/signverify validation
This commit is contained in:
Vladimir Volek 2019-03-29 13:44:37 +01:00 committed by GitHub
commit 263e09dad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -141,12 +141,16 @@ const inputChange = (inputName: string, value: string): ThunkAction => (
type: SIGN_VERIFY.TOUCH,
inputName,
});
if (inputName === 'verifyAddress' && validateAddress(value) !== null) {
dispatch({
type: SIGN_VERIFY.ERROR,
inputName,
message: validateAddress(value),
});
if (inputName === 'verifyAddress') {
const error = validateAddress(value);
if (error) {
dispatch({
type: SIGN_VERIFY.ERROR,
inputName,
message: error,
});
}
}
};

View File

@ -57,6 +57,8 @@ export default (state: State = initialState, action: Action): State => {
return {
...state,
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 {

View File

@ -140,6 +140,7 @@ class SignVerify extends Component<Props> {
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
</StyledButton>
<StyledButton
isDisabled={!device.connected}
onClick={() =>
signVerifyActions.sign(account.accountPath, signMessage)
}
@ -194,7 +195,7 @@ class SignVerify extends Component<Props> {
<FormattedMessage {...l10nCommonMessages.TR_CLEAR} />
</StyledButton>
<StyledButton
isDisabled={!!verifyAddressError}
isDisabled={!!verifyAddressError || !device.connected}
onClick={() => {
if (errors.length <= 0) {
signVerifyActions.verify(