From 0c741814f34e7ac5dc103c906136411ceb6d3703 Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Mon, 3 Nov 2014 14:34:38 -0300 Subject: [PATCH] Removed console errors --- js/controllers/importProfile.js | 8 -------- js/models/Identity.js | 19 ++++++------------- js/routes.js | 1 - 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/js/controllers/importProfile.js b/js/controllers/importProfile.js index 6b32229a9..dd900ec6f 100644 --- a/js/controllers/importProfile.js +++ b/js/controllers/importProfile.js @@ -19,12 +19,6 @@ angular.module('copayApp.controllers').controller('ImportProfileController', var _importBackup = function(str) { var password = $scope.password; updateStatus('Importing profile - Setting things up...'); - // var skipFields = []; - // if ($scope.skipPublicKeyRing) - // skipFields.push('publicKeyRing'); - // - // if ($scope.skipTxProposals) - // skipFields.push('txProposals'); copay.Identity.importFromEncryptedFullJson(str, password, { pluginManager: pluginManager, @@ -34,11 +28,9 @@ angular.module('copayApp.controllers').controller('ImportProfileController', passphraseConfig: config.passphraseConfig, }, function(err, iden) { if (err && !iden) { - console.log('Error:' + err) controllerUtils.onErrorDigest( $scope, (err.toString() || '').match('BADSTR') ? 'Bad password or corrupt profile file' : 'Unknown error'); } else { - console.log('Success.....Profile imported successfully'); notification.info('Success', 'Profile imported successfully'); $location.path('/'); } diff --git a/js/models/Identity.js b/js/models/Identity.js index b7ee01a17..7d5079a44 100644 --- a/js/models/Identity.js +++ b/js/models/Identity.js @@ -287,17 +287,6 @@ Identity.prototype.close = function(cb) { * @return {Wallet} */ Identity.prototype.importEncryptedWallet = function(cypherText, password, opts, cb) { - console.log('importEncryptedWallet------'); - - console.log('opts'); - console.log(opts); - - console.log('password'); - console.log(password); - - console.log('cypherText'); - console.log(cypherText); - var crypto = opts.cryptoUtil || cryptoUtil; // TODO set iter and salt using config.js var key = crypto.kdf(password); @@ -355,7 +344,11 @@ Identity.prototype.closeWallet = function(wallet, cb) { Identity.importFromEncryptedFullJson = function(str, password, opts, cb) { var crypto = opts.cryptoUtil || cryptoUtil; var key = crypto.kdf(password); - return Identity.importFromFullJson(crypto.decrypt(key, str), password, opts, cb); + var str = crypto.decrypt(key, str); + if (!str) { + return cb('BADSTR'); + } + return Identity.importFromFullJson(str, password, opts, cb); }; Identity.importFromFullJson = function(str, password, opts, cb) { @@ -364,7 +357,7 @@ Identity.importFromFullJson = function(str, password, opts, cb) { try { json = JSON.parse(str); } catch (e) { - return cb('Unable to retrieve json from string', str); + return cb('BADSTR: Unable to retrieve json from string', str); } // if (!_.isNumber(json.iterations)) diff --git a/js/routes.js b/js/routes.js index f9fa74cb1..c179876f7 100644 --- a/js/routes.js +++ b/js/routes.js @@ -112,7 +112,6 @@ angular $location.path('unsupported'); } else { if (!$rootScope.iden && next.logged) { - console.log('not logged... redirecting') $idle.unwatch(); $location.path('/'); }