Skip to content

Commit f4c418c

Browse files
committed
[fix] Wallets import: import failed on windows - fix #810
[fix] Wallets: should not need to auth, when encryption disabled
1 parent 44b0bfa commit f4c418c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

www/js/controllers/wallets-controllers.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
147147
.then(function(newName) {
148148
if (!newName) return;
149149

150-
// Save changes
151-
return csWallet.auth({minData: true})
150+
// Auth (if encryption is need)
151+
return (csSettings.data.useLocalStorageEncryption ? csWallet.auth({minData: true}) : $q.when())
152+
153+
// Save changes
152154
.then(function() {
153155
wallet.data.localName = newName;
154156
csWallet.storeData();
@@ -174,7 +176,7 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
174176
if (!wallet) return $q.reject("Missing 'wallet' argument");
175177

176178
// Make sure auth on the main wallet
177-
if (!csWallet.isAuth() && csSettings.data.useLocalStorageEncryption) {
179+
if (csSettings.data.useLocalStorageEncryption && !csWallet.isAuth()) {
178180
return csWallet.auth({minData: true})
179181
.then(function() {
180182
return $scope.addNewWallet(wallet); // loop
@@ -259,8 +261,10 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
259261
.then(function(wallet) {
260262
if (!wallet || !wallet.id) return;
261263

262-
// Make sure to auth on the main wallet
263-
return csWallet.auth({minData: true})
264+
// Auth (if encryption is need))
265+
return (csSettings.data.useLocalStorageEncryption ? csWallet.auth({minData: true}) : $q.when())
266+
267+
// Remove the wallet
264268
.then(function() {
265269
csWallet.children.remove(wallet.id);
266270
UIUtils.loading.hide();
@@ -303,8 +307,9 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
303307
if (!items || !items.length) return; // User cancel
304308

305309
UIUtils.loading.show();
306-
// Make sure to auth on the main wallet
307-
return csWallet.auth({minData: true})
310+
311+
// Auth (if encryption is need)
312+
return (csSettings.data.useLocalStorageEncryption ? csWallet.auth({minData: true}) : $q.when())
308313
.then(function() {
309314
// Add wallet one after one
310315
return items.reduce(function(promise, authData){
@@ -705,7 +710,8 @@ function WalletListImportModalController($scope, $timeout, BMA, csWallet) {
705710

706711
$scope.hasContent = angular.isDefined(file) && file !== '';
707712
$scope.fileData = file.fileData ? file.fileData : '';
708-
var isValidFile = $scope.fileData !== '' && ($scope.fileData.type == 'text/csv' || $scope.fileData.type == 'text/plain');
713+
var isValidFile = $scope.fileData !== '' &&
714+
($scope.fileData.type == 'text/csv' || $scope.fileData.type == 'text/plain' || 'application/vnd.ms-excel' /*fix issue #810*/);
709715

710716
// Bad file type: invalid file
711717
if (!isValidFile) {

0 commit comments

Comments
 (0)