From e960e17079ec410014163b3844fa396312f9ccb9 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 2 Oct 2015 16:30:20 -0300 Subject: [PATCH] fix key control --- src/js/controllers/paperWallet.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/js/controllers/paperWallet.js b/src/js/controllers/paperWallet.js index dedcf4ad4..d58664bf8 100644 --- a/src/js/controllers/paperWallet.js +++ b/src/js/controllers/paperWallet.js @@ -10,9 +10,9 @@ angular.module('copayApp.controllers').controller('paperWalletController', self.createTx = function(privateKey, passphrase) { if (privateKey.charAt(0) != 6) { - var isValidPrivateKey = self.checkPrivateKey(privateKey); + var isValidKey = self.checkPrivateKey(privateKey); - if (isValidPrivateKey != true) return self.error = isValidPrivateKey; + if (!isValidKey) return; } self.error = null; @@ -39,7 +39,8 @@ angular.module('copayApp.controllers').controller('paperWalletController', try { new bitcore.PrivateKey(privateKey, 'livenet'); } catch (err) { - return err.toString(); + self.error = err.toString(); + return false; } return true; } @@ -83,16 +84,16 @@ angular.module('copayApp.controllers').controller('paperWalletController', self.sending = true; $timeout(function() { self.doTransaction(rawTx).then(function(err, response) { - self.sending = false; - self.goHome(); - }, - function(err) { - self.sending = false; - self.error = err.toString(); - $timeout(function() { - $scope.$apply(); - }, 1); - }); + self.sending = false; + self.goHome(); + }, + function(err) { + self.sending = false; + self.error = err.toString(); + $timeout(function() { + $scope.$apply(); + }, 1); + }); }, 100); };