From 594fb8c3503c0ca6280a691fb570eac39e1d1924 Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Fri, 15 Aug 2014 23:00:12 -0300 Subject: [PATCH] Fix address and amount validation --- js/controllers/send.js | 2 +- js/directives.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index 3e1c23c31..f242dd82d 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -37,7 +37,7 @@ angular.module('copayApp.controllers').controller('SendController', if ($rootScope.pendingPayment) { var pp = $rootScope.pendingPayment; - $scope.address = pp.address; + $scope.address = pp.address + ''; var amount = pp.data.amount / config.unitToSatoshi * 100000000; $scope.amount = amount; $scope.commentText = pp.data.message; diff --git a/js/directives.js b/js/directives.js index d704b6073..620eeded5 100644 --- a/js/directives.js +++ b/js/directives.js @@ -47,8 +47,9 @@ angular.module('copayApp.directives') var val = function(value) { var availableBalanceNum = Number(($rootScope.availableBalance * config.unitToSatoshi).toFixed(0)); var vNum = Number((value * config.unitToSatoshi).toFixed(0)) + feeSat; + if (typeof vNum == "number" && vNum > 0) { - if (availableBalanceNum < vNum) { + if (availableBalanceNum < vNum || isNaN(availableBalanceNum)) { ctrl.$setValidity('enoughAmount', false); scope.notEnoughAmount = true; } else {