diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index b8f129fef1176065159b5680c7e226bcc62c9a1a..f25a3a96bccc2c6fa635b6aa038a039212bfa7ba 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -681,13 +681,17 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t level: '4', questions : [] }; - - for (var i = 1; i<20; i++){ - $translate('ACCOUNT.SECURITY.QUESTION_' + i.toString()) - .then(function(translation){ + var questions = []; + for (var i = 1; i<20; i++) { + questions.push('ACCOUNT.SECURITY.QUESTION_' + i.toString()); + } + $translate(questions) + .then(function(translations){ + _.each(translations, function(translation){ $scope.formData.questions.push({value: translation , checked: false}); - }) - }; + }); + }); + $scope.slidePrev = function() { $scope.slides.slider.unlockSwipes(); @@ -754,18 +758,18 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t level: '4', questions: [] }; - for (var i = 1; i < 20; i++) { - $translate('ACCOUNT.SECURITY.QUESTION_' + i.toString()) - .then(function (translation) { + $translate(questions) + .then(function (translations) { + _.each(translations, function (translation) { $scope.formData.questions.push({value: translation, checked: false}); - }) - } + }); + }); } else if ($scope.slides.slider.activeIndex === 2 && $scope.option === 'saveID') { _.each($scope.formData.questions, function(question){ question.answer = undefined; - }) + }); } else if ($scope.slides.slider.activeIndex === 1 && $scope.option === 'recoverID'){ @@ -778,7 +782,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t else if ($scope.slides.slider.activeIndex === 2 && $scope.option === 'recoverID'){ _.each($scope.recover.questions, function(element){ element.answer = undefined; - }) + }); } else if ($scope.slides.slider.activeIndex === 2 && $scope.option === 'revocation'){ @@ -836,7 +840,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t $scope.recover.answer = ''; _.each($scope.recover.questions, function(element){ $scope.recover.answer += element.answer; - }) + }); return csWallet.recoverId($scope.recover) .then(function (recover){ @@ -847,7 +851,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t else { UIUtils.alert.error('ERROR.RECOVER_ID_FAILED'); } - }) + }); }; @@ -855,7 +859,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t * Save Id */ $scope.addQuestion = function(){ - if ($scope.formData.addQuestion != '') { + if ($scope.formData.addQuestion !== '') { $scope.formData.questions.push({value: $scope.formData.addQuestion, checked: true}); $scope.formData.addQuestion = ''; } @@ -899,7 +903,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t .then(function(record){ csWallet.downloadSaveId(record); $scope.closeModal(); - }) + }); }); }; @@ -917,7 +921,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t else { UIUtils.alert.error("ERROR.ONLY_TEXT_FILE", "ERROR.LOAD_FILE_FAILED"); } - } + }; /** * Download revocation file @@ -960,7 +964,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t return csWallet.revoke(); } else { - return csWallet.revokeWithFile($scope.revocation) + return csWallet.revokeWithFile($scope.revocation); } }) .then(function () { diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index 3930302c8ba1b75fd9803c066c4c448da8c6add2..2a11ec31f1eb0ef60dc196f2ce723270c9cdac07 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -1441,15 +1441,15 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser getCryptedId = function(record){ return getkeypairSaveId(record) .then(function() { - return CryptoUtils.util.random_nonce() + return CryptoUtils.util.random_nonce(); }) .then(function(nonce) { record.nonce = nonce; - return CryptoUtils.box.pack(record.salt, record.nonce, record.keypair.boxPk, record.keypair.boxSk) + return CryptoUtils.box.pack(record.salt, record.nonce, record.keypair.boxPk, record.keypair.boxSk); }) .then(function (cypherSalt) { record.salt = cypherSalt; - return CryptoUtils.box.pack(record.pwd, record.nonce, record.keypair.boxPk, record.keypair.boxSk) + return CryptoUtils.box.pack(record.pwd, record.nonce, record.keypair.boxPk, record.keypair.boxSk); }) .then(function (cypherPwd) { record.pwd = cypherPwd; @@ -1462,11 +1462,11 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser var nonce = CryptoUtils.util.decode_base58(recover.cypherNonce); return getkeypairSaveId(recover) .then(function (recover) { - return CryptoUtils.box.open(recover.cypherSalt, nonce, recover.keypair.boxPk, recover.keypair.boxSk) + return CryptoUtils.box.open(recover.cypherSalt, nonce, recover.keypair.boxPk, recover.keypair.boxSk); }) .then(function (salt) { recover.salt = salt; - return CryptoUtils.box.open(recover.cypherPwd, nonce, recover.keypair.boxPk, recover.keypair.boxSk) + return CryptoUtils.box.open(recover.cypherPwd, nonce, recover.keypair.boxPk, recover.keypair.boxSk); }) .then(function (pwd) { recover.pwd = pwd; @@ -1609,12 +1609,12 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser else { throw err; } - }) + }); } else { addEvent({type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); } - }) + }); },