Fix address and amount validation

This commit is contained in:
Yemel Jardi 2014-08-15 23:00:12 -03:00
commit 594fb8c350
2 changed files with 3 additions and 2 deletions

View file

@ -37,7 +37,7 @@ angular.module('copayApp.controllers').controller('SendController',
if ($rootScope.pendingPayment) { if ($rootScope.pendingPayment) {
var pp = $rootScope.pendingPayment; var pp = $rootScope.pendingPayment;
$scope.address = pp.address; $scope.address = pp.address + '';
var amount = pp.data.amount / config.unitToSatoshi * 100000000; var amount = pp.data.amount / config.unitToSatoshi * 100000000;
$scope.amount = amount; $scope.amount = amount;
$scope.commentText = pp.data.message; $scope.commentText = pp.data.message;

View file

@ -47,8 +47,9 @@ angular.module('copayApp.directives')
var val = function(value) { var val = function(value) {
var availableBalanceNum = Number(($rootScope.availableBalance * config.unitToSatoshi).toFixed(0)); var availableBalanceNum = Number(($rootScope.availableBalance * config.unitToSatoshi).toFixed(0));
var vNum = Number((value * config.unitToSatoshi).toFixed(0)) + feeSat; var vNum = Number((value * config.unitToSatoshi).toFixed(0)) + feeSat;
if (typeof vNum == "number" && vNum > 0) { if (typeof vNum == "number" && vNum > 0) {
if (availableBalanceNum < vNum) { if (availableBalanceNum < vNum || isNaN(availableBalanceNum)) {
ctrl.$setValidity('enoughAmount', false); ctrl.$setValidity('enoughAmount', false);
scope.notEnoughAmount = true; scope.notEnoughAmount = true;
} else { } else {