1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Add frontend validation to check if send ether input is a valid number.

This commit is contained in:
Kevin Serrano 2017-12-27 17:36:56 -08:00
parent adf4b89804
commit 92eb16fc11
No known key found for this signature in database
GPG Key ID: BF999DEFC7371BA1

View File

@ -247,6 +247,12 @@ SendTransactionScreen.prototype.onSubmit = function () {
const recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '')
const nickname = state.nickname || ' '
const input = document.querySelector('input[name="amount"]').value
if (isNaN(input)) {
message = 'Invalid ether value.'
return this.props.dispatch(actions.displayWarning(message))
}
const value = util.normalizeEthStringToWei(input)
const txData = document.querySelector('input[name="txData"]').value
const balance = this.props.balance