diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index a78629d02978168d6774f6ff5397c92e164dabad..976430e8452167a12bdda408d7bcf0f6c2b243a5 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -476,7 +476,9 @@ "INVALID_BLOCK_HASH": "Block not found (incorrect hash)", "REVOCATION_FAILED": "Error while trying to revoke the identity.", "SALT_OR_PASSWORD_NOT_CONFIRMED": "Wrong phrase or password ", - "RECOVER_ID_FAILED": "Could not recover password" + "RECOVER_ID_FAILED": "Could not recover password", + "LOAD_FILE_FAILED" : "Unable to load file", + "ONLY_TEXT_FILE": "You have to select a text file" }, "INFO": { "POPUP_TITLE": "Information", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 2dd7f82c1a78cf722c49cad2519267a3892346c6..df08039d4615b7891d95642c4db6376645c19abf 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -476,7 +476,9 @@ "INVALID_BLOCK_HASH": "Bloc non trouvé (hash différent)", "REVOCATION_FAILED": "Echec de la révocation.", "SALT_OR_PASSWORD_NOT_CONFIRMED": "Phrase de protection ou mot de passe incorrects", - "RECOVER_ID_FAILED": "Echec de la récupération des identifiants" + "RECOVER_ID_FAILED": "Echec de la récupération des identifiants", + "LOAD_FILE_FAILED" : "Echec du chargement du fichier", + "ONLY_TEXT_FILE": "Vous devez selectionner un fichier texte" }, "INFO": { "POPUP_TITLE": "Information", diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index e3ae2da26b111adf76af6e70a4bdd08c43d575c0..b8f129fef1176065159b5680c7e226bcc62c9a1a 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -712,8 +712,16 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t ($scope.slides.slider.activeIndex === 2 && $scope.option === "saveID" ? 'answersForm' : ($scope.slides.slider.activeIndex === 3 && $scope.option === "saveID" ? 'loginForm' : formName))); - if ($scope.slides.slider.activeIndex === 1 && $scope.option === "recoverID" && $scope.isValidFile){ - $scope.slideNext(); + if ($scope.slides.slider.activeIndex === 1 && $scope.option === "recoverID") { + if ($scope.isValidFile) { + $scope.slideNext(); + $scope.hasContent = false; + $scope.fileData = ''; + + } + else { + UIUtils.alert.error("ERROR.ONLY_TEXT_FILE", "ERROR.LOAD_FILE_FAILED"); + } } } @@ -903,10 +911,12 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t }; $scope.revokeWithFile = function(){ - if ($scope.slides.slider.activeIndex === 2 && $scope.option === "revocation" && $scope.isValidFile){ - console.debug($scope.revocation); - $scope.revokeIdentity(); - } + if ($scope.isValidFile) { + $scope.revokeIdentity(); + } + else { + UIUtils.alert.error("ERROR.ONLY_TEXT_FILE", "ERROR.LOAD_FILE_FAILED"); + } } /** @@ -955,8 +965,7 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t }) .then(function () { UIUtils.toast.show("INFO.REVOCATION_SENT"); - $scope.revocation = undefined; - $scope.updateView(); + $scope.closeModal(); return UIUtils.loading.hide(); }) .catch(function (err) { @@ -964,13 +973,4 @@ function WalletSecurityModalController($scope, $rootScope, UIUtils, csWallet, $t }); }; - // Update view - $scope.updateView = function() { - // Set Motion - $timeout(function() { - UIUtils.motion.fadeSlideInRight({selector: '#wallet .animate-fade-slide-in-right .item'}); - // Set Ink - UIUtils.ink({selector: '#wallet .animate-fade-slide-in-right .item'}); - }, 10); - }; } diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index d9411f51d8033a9a5a63cbd79b2b28f320a3d516..148e1e02f414fbfcdcd8a28b27e5c80d23837b13 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -1549,10 +1549,10 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser // Get revocation document return getRevocationDocument() .then(function(revocation){ - console.debug(revocation); + console.debug(typeof revocation + '\n' + revocation); }) -/* // Send revocation document + // Send revocation document .then(function(revocation) { return BMA.wot.revoke({revocation: revocation}); }) @@ -1580,34 +1580,46 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser throw err; } }) - ;*/ + ; }, revokeWithFile = function(revocation){ - console.debug(revocation); - /*return BMA.wot.revoke({revocation: revocation}) + console.debug(typeof revocation + '\n' + revocation); + return BMA.wot.revoke({revocation: revocation}) // Reload requirements .then(function() { - return $timeout(function() { - return loadRequirements(); - }, 1000); // waiting for node to process membership doc - }) - - .then(function() { - finishLoadRequirements(); - - // Add user event - addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); - }) - .catch(function(err) { - if (err && err.ucode == BMA.errorCodes.REVOCATION_ALREADY_REGISTERED) { - // Already registered by node: just add an event - addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); + if (isLogin()) { + return $timeout(function () { + return loadRequirements(); + }, 1000) // waiting for node to process membership doc + + .then(function () { + finishLoadRequirements(); + // Add user event + addEvent({ + type: 'pending', + message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', + context: 'revocation' + }, true); + }) + .catch(function (err) { + if (err && err.ucode == BMA.errorCodes.REVOCATION_ALREADY_REGISTERED) { + // Already registered by node: just add an event + addEvent({ + type: 'pending', + message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', + context: 'revocation' + }, true); + } + else { + throw err; + } + }) } else { - throw err; + addEvent({type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); } - })*/ + }) },