Prevent non-positive-number amounts for send / request commands

This commit is contained in:
Gustavo Nunes 2017-01-10 01:30:32 -02:00
parent db3c3111d0
commit 66c9e97eef
1 changed files with 16 additions and 0 deletions

View File

@ -752,6 +752,7 @@ function validateSend(params, context) {
try { try {
var val = web3.toWei(params.amount, "ether"); var val = web3.toWei(params.amount, "ether");
if (val <= 0) { throw new Error(); }
} catch (err) { } catch (err) {
return { return {
errors: [ errors: [
@ -895,4 +896,19 @@ status.command({
} }
}; };
}, },
validator: function(params) {
try {
var val = web3.toWei(params.amount, "ether");
if (val <= 0) { throw new Error(); }
} catch (err) {
return {
errors: [
status.components.validationMessage(
I18n.t('validation_title'),
I18n.t('validation_invalid_number')
)
]
};
}
}
}); });