diff --git a/index.html b/index.html index f160a81f2..9994794a6 100644 --- a/index.html +++ b/index.html @@ -187,7 +187,7 @@

{{title}}

- +
Select a backup file
Or just paste the backup text here
diff --git a/js/controllers/import.js b/js/controllers/import.js index 27510d60c..d04fd54fc 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -4,7 +4,7 @@ angular.module('copay.import').controller('ImportController', function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) { $scope.title = 'Import a backup'; - + var reader = new FileReader(); var _importBackup = function(encryptedObj) { var passphrase = Passphrase.getBase64($scope.password); $rootScope.wallet = walletFactory.fromEncryptedObj(encryptedObj, passphrase); @@ -12,8 +12,6 @@ angular.module('copay.import').controller('ImportController', }; $scope.getFile = function() { - var reader = new FileReader(); - // If we use onloadend, we need to check the readyState. reader.onloadend = function(evt) { if (evt.target.readyState == FileReader.DONE) { // DONE == 2 @@ -24,8 +22,8 @@ angular.module('copay.import').controller('ImportController', }; $scope.import = function() { - if ($scope.password != '') { - if ($scope.backupText != '') { + if ($scope.password) { + if ($scope.backupText) { _importBackup($scope.backupText); } else { reader.readAsBinaryString($scope.file);