Merge pull request #704 from GustavoNunes/bug/request-null-eth-#668

Prevent non-positive-number amounts for send / request commands (#668)
This commit is contained in:
Jarrad 2017-01-12 15:36:55 +07:00 committed by GitHub
commit 395d3de927
1 changed files with 16 additions and 0 deletions

View File

@ -752,6 +752,7 @@ function validateSend(params, context) {
try {
var val = web3.toWei(params.amount, "ether");
if (val <= 0) { throw new Error(); }
} catch (err) {
return {
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')
)
]
};
}
}
});