fix key control

This commit is contained in:
Javier 2015-10-02 16:30:20 -03:00
commit e960e17079

View file

@ -10,9 +10,9 @@ angular.module('copayApp.controllers').controller('paperWalletController',
self.createTx = function(privateKey, passphrase) { self.createTx = function(privateKey, passphrase) {
if (privateKey.charAt(0) != 6) { 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; self.error = null;
@ -39,7 +39,8 @@ angular.module('copayApp.controllers').controller('paperWalletController',
try { try {
new bitcore.PrivateKey(privateKey, 'livenet'); new bitcore.PrivateKey(privateKey, 'livenet');
} catch (err) { } catch (err) {
return err.toString(); self.error = err.toString();
return false;
} }
return true; return true;
} }
@ -83,16 +84,16 @@ angular.module('copayApp.controllers').controller('paperWalletController',
self.sending = true; self.sending = true;
$timeout(function() { $timeout(function() {
self.doTransaction(rawTx).then(function(err, response) { self.doTransaction(rawTx).then(function(err, response) {
self.sending = false; self.sending = false;
self.goHome(); self.goHome();
}, },
function(err) { function(err) {
self.sending = false; self.sending = false;
self.error = err.toString(); self.error = err.toString();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 1); }, 1);
}); });
}, 100); }, 100);
}; };