diff --git a/scss/ionic.app.scss b/scss/ionic.app.scss index 90e368e365baa182a1875be4014c1cb3c12e673b..0abe8728da3ba8e92acfb922e3097e69633b3f69 100644 --- a/scss/ionic.app.scss +++ b/scss/ionic.app.scss @@ -1855,7 +1855,9 @@ div[dropzone] { } } - +/********** + Wot identity +**********/ .hero.dark-bg { background-color: #555; } diff --git a/www/css/ionic.app.css b/www/css/ionic.app.css index 4282b1ab1ca81761d665d9c1022affb4802adf24..6c86587e8e8309fcd3045f021f9c2f9d5a15b61e 100644 --- a/www/css/ionic.app.css +++ b/www/css/ionic.app.css @@ -15108,6 +15108,9 @@ div[dropzone] { .button-icon-event .icon-event { pointer-events: all !important; } +/********** + Wot identity +**********/ .hero.dark-bg { background-color: #555; } diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 53c0f096e8f3de775deb93954e6a7afc03276366..e4e5217bf18c1c3f7f7880820e4c3cafbb7e52a0 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -247,6 +247,8 @@ "NO_CERTIFICATION": "No validated certification", "NO_GIVEN_CERTIFICATION": "No given certification", "NOT_MEMBER_PARENTHESIS": "(non-member)", + "IDENTITY_REVOKED_PARENTHESIS": "(identity revoked)", + "MEMBER_PENDING_REVOCATION_PARENTHESIS": "(being revoked)", "EXPIRE_IN": "Expires", "NOT_WRITTEN_EXPIRE_IN": "Deadline<br/>treatment", "EXPIRED": "Expired", @@ -472,6 +474,7 @@ "INVALID_COMMENT": "Field 'reference' has a bad format.", "INVALID_PUBKEY": "Public key has a bad format.", "IDENTITY_REVOKED": "This identity <b>has been revoked {{revocationTime|formatFromNow}}</b> ({{revocationTime|formatDate}}). It can no longer become a member.", + "IDENTITY_PENDING_REVOCATION": "The <b>revocation of this identity</b> has been requested and is awaiting processing. Certification is therefore disabled.", "IDENTITY_INVALID_BLOCK_HASH": "This membership application is no longer valid (because it references a block that network peers are cancelled): the person must renew its application for membership <b>before</b> being certified.", "IDENTITY_EXPIRED": "This identity has expired: this person must re-apply <b>before</b> being certified.", "IDENTITY_SANDBOX_FULL": "Could not register, because peer's sandbox is full.<br/><br/>Please retry later or choose another Duniter peer (in <b>Settings</b>).", @@ -479,6 +482,7 @@ "WOT_PENDING_INVALID_BLOCK_HASH": "Membership not valid.", "WALLET_INVALID_BLOCK_HASH": "Your membership application is no longer valid (because it references a block that network peers are cancelled).<br/>You must <a ng-click=\"doQuickFix('renew')\">renew your application for membership</a> to fix this issue.", "WALLET_IDENTITY_EXPIRED": "The publication of your identity <b>has expired</b>.<br/>You must <a ng-click=\"doQuickFix('fixIdentity')\">re-issue your identity</a> to resolve this issue.", + "WALLET_REVOKED": "Your identity has been <b>revoked</b>: neither your pseudonym nor your public key will be used in the future for a member account.", "WALLET_HAS_NO_SELF": "Your identity must first have been published, and not expired.", "IDENTITY_ALREADY_CERTIFY": "You have <b>already certified</b> that identity.<br/><br/>Your certificate is still valid (expires {{expiresIn|formatDuration}}).", "IDENTITY_ALREADY_CERTIFY_PENDING": "You have <b>already certified</b> that identity.<br/><br/>Your certification is still pending (Deadline for treatment {{expiresIn|formatDuration}}).", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index bf6b937216fdb2c5f67d0356ad2e82fb2f0f75c5..7aeac90b57e08df8d47c2a6aa5ada8c036f833ab 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -247,6 +247,8 @@ "NO_CERTIFICATION": "No validated certification", "NO_GIVEN_CERTIFICATION": "No given certification", "NOT_MEMBER_PARENTHESIS": "(non-member)", + "IDENTITY_REVOKED_PARENTHESIS": "(identity revoked)", + "MEMBER_PENDING_REVOCATION_PARENTHESIS": "(being revoked)", "EXPIRE_IN": "Expires", "NOT_WRITTEN_EXPIRE_IN": "Deadline<br/>treatment", "EXPIRED": "Expired", @@ -472,6 +474,7 @@ "INVALID_COMMENT": "Field 'reference' has a bad format.", "INVALID_PUBKEY": "Public key has a bad format.", "IDENTITY_REVOKED": "This identity <b>has been revoked {{revocationTime|formatFromNow}}</b> ({{revocationTime|formatDate}}). It can no longer become a member.", + "IDENTITY_PENDING_REVOCATION": "The <b>revocation of this identity</b> has been requested and is awaiting processing. Certification is therefore disabled.", "IDENTITY_INVALID_BLOCK_HASH": "This membership application is no longer valid (because it references a block that network peers are cancelled): the person must renew its application for membership <b>before</b> being certified.", "IDENTITY_EXPIRED": "This identity has expired: this person must re-apply <b>before</b> being certified.", "IDENTITY_SANDBOX_FULL": "Could not register, because peer's sandbox is full.<br/><br/>Please retry later or choose another Duniter peer (in <b>Settings</b>).", @@ -479,6 +482,7 @@ "WOT_PENDING_INVALID_BLOCK_HASH": "Membership not valid.", "WALLET_INVALID_BLOCK_HASH": "Your membership application is no longer valid (because it references a block that network peers are cancelled).<br/>You must <a ng-click=\"doQuickFix('renew')\">renew your application for membership</a> to fix this issue.", "WALLET_IDENTITY_EXPIRED": "The publication of your identity <b>has expired</b>.<br/>You must <a ng-click=\"doQuickFix('fixIdentity')\">re-issue your identity</a> to resolve this issue.", + "WALLET_REVOKED": "Your identity has been <b>revoked</b>: neither your pseudonym nor your public key will be used in the future for a member account.", "WALLET_HAS_NO_SELF": "Your identity must first have been published, and not expired.", "IDENTITY_ALREADY_CERTIFY": "You have <b>already certified</b> that identity.<br/><br/>Your certificate is still valid (expires {{expiresIn|formatDuration}}).", "IDENTITY_ALREADY_CERTIFY_PENDING": "You have <b>already certified</b> that identity.<br/><br/>Your certification is still pending (Deadline for treatment {{expiresIn|formatDuration}}).", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 3e54b3fcd3ea8378abab5f7812801dde3ec1aaaf..c0eb540617c265b1e8135e4014504ec78413bef0 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -247,6 +247,8 @@ "NO_CERTIFICATION": "Aucune certification validée", "NO_GIVEN_CERTIFICATION": "Aucune certification émise", "NOT_MEMBER_PARENTHESIS": "(non membre)", + "IDENTITY_REVOKED_PARENTHESIS": "(identité revoquée)", + "MEMBER_PENDING_REVOCATION_PARENTHESIS": "(en cours de révocation)", "EXPIRE_IN": "Expiration", "NOT_WRITTEN_EXPIRE_IN": "Date limite<br/>de traitement", "EXPIRED": "Expiré", @@ -439,7 +441,7 @@ "SEND_IDENTITY_FAILED": "Echec de l'inscription.", "SEND_CERTIFICATION_FAILED": "Echec de la certification.", "NEED_MEMBER_ACCOUNT_TO_CERTIFY": "Vous ne pouvez pas effectuer de certification, car votre compte n'est <b>pas membre</b>.", - "NEED_MEMBER_ACCOUNT_TO_CERTIFY_HAS_SELF": "Vous ne pouvez pas effectuer de certification, car votre compte n'est <p>pas encore membre</b>.<br/><br/>Il vous manque encore des certification pour devenir membre.", + "NEED_MEMBER_ACCOUNT_TO_CERTIFY_HAS_SELF": "Vous ne pouvez pas effectuer de certification, car votre compte n'est pas encore membre.<br/><br/>Il vous manque encore des certifications, ou bien celles-ci n'ont pas encore été validées.", "NOT_MEMBER_FOR_CERTIFICATION": "Votre compte n'est pas encore membre.", "IDENTITY_TO_CERTIFY_HAS_NO_SELF": "Compte non certifiable. Aucune demande d'adhésion n'a été faite, ou bien elle n'a pas été renouvellée.", "LOGIN_FAILED": "Erreur lors de l'authentification.", @@ -472,6 +474,7 @@ "INVALID_COMMENT": "Le champ 'référence' ne doit pas contenir de caractères accentués.", "INVALID_PUBKEY": "La clé publique n'a pas le format attendu.", "IDENTITY_REVOKED": "Cette identité <b>a été révoquée {{revocationTime|formatFromNow}}</b> ({{revocationTime|formatDate}}). Elle ne peut plus devenir membre.", + "IDENTITY_PENDING_REVOCATION": "La <b>révocation de cette identité</b> a été demandée et est en attente de traitement. La certification est donc désactivée.", "IDENTITY_INVALID_BLOCK_HASH": "Cette demande d'adhésion n'est plus valide (car elle référence un bloc que les nœuds du réseau ont annulé) : cette personne doit renouveler sa demande d'adhésion <b>avant</b> d'être certifiée.", "IDENTITY_EXPIRED": "La publication de cette identité a expirée : cette personne doit effectuer une nouvelle demande d'adhésion <b>avant</b> d'être certifiée.", "IDENTITY_SANDBOX_FULL": "Le nœud Duniter utilisé par Cesium ne peut plus recevoir de nouvelles identités, car sa file d'attente est pleine.<br/><br/>Veuillez réessayer ultérieurement ou changer de nœud (via le menu <b>Paramètres</b>).", @@ -479,6 +482,7 @@ "WOT_PENDING_INVALID_BLOCK_HASH": "Adhésion non valide.", "WALLET_INVALID_BLOCK_HASH": "Votre demande d'adhésion n'est plus valide (car elle référence un bloc que les nœuds du réseau ont annulé).<br/>Vous devez <a ng-click=\"doQuickFix('fixMembership')\">envoyer une nouvelle demande</a> pour résoudre ce problème.", "WALLET_IDENTITY_EXPIRED": "La publication de <b>votre identité a expirée</b>.<br/>Vous devez <a ng-click=\"doQuickFix('fixIdentity')\">publier à nouveau votre identité</a> pour résoudre ce problème.", + "WALLET_REVOKED": "Votre identité a été <b>révoquée</b> : ni votre pseudonyme ni votre clef publique ne pourront être utilisés à l'avenir pour un compte membre.", "WALLET_HAS_NO_SELF": "Votre identité doit d'abord avoir été publiée, et ne pas être expirée.", "IDENTITY_ALREADY_CERTIFY": "Vous avez <b>déjà certifié</b> cette identité.<br/><br/>Cette certification est encore valide (expiration {{expiresIn|formatDurationTo}}).", "IDENTITY_ALREADY_CERTIFY_PENDING": "Vous avez <b>déjà certifié</b> cette identité.<br/><br/>Cette certification est en attente de traitement (date limite de traitement {{expiresIn|formatDurationTo}}).", @@ -505,7 +509,7 @@ "NOT_NEED_MEMBERSHIP": "Vous êtes déjà membre.", "IDENTITY_WILL_MISSING_CERTIFICATIONS": "Cette identité va bientôt manquer de certification (au moins {{willNeedCertificationCount}}).", "REVOCATION_SENT": "Revocation envoyée", - "REVOCATION_SENT_WAITING_PROCESS": "La <b>révocation de cette identité</b> a été envoyée avec succès. Elle est en attente de traitement.", + "REVOCATION_SENT_WAITING_PROCESS": "La <b>révocation de cette identité</b> a été demandée et est en attente de traitement.", "FEATURES_NOT_IMPLEMENTED": "Cette fonctionnalité est encore en cours de développement.<br/><br/>Pourquoi ne pas <b>contribuer à Cesium</b>, pour l'obtenir plus rapidement ? ;)" }, "CONFIRM": { @@ -522,8 +526,8 @@ "FIX_IDENTITY": "Le pseudonyme <b>{{uid}}</b> va être publiée à nouveau, en remplacement de l'ancienne publication qui a expirée.<br/></br/><b>Etes-vous sûr</b> de vouloir continuer ?", "FIX_MEMBERSHIP": "Votre demande d'adhésion comme membre va être renvoyée.<br/></br/><b>Etes-vous sûr</b> de vouloir continuer ?", "RENEW_MEMBERSHIP": "Votre adhésion comme membre va être renouvellée.<br/></br/><b>Etes-vous sûr</b> de vouloir continuer ?", - "REVOKE_IDENTITY": "Vous allez <b>revoquer définitivement cette identité</b>.<br/><br/>La clé publique et le pseudonyme associés <b>ne pourront plus jamais être utilisés</b> (pour un compte membre). <br/></br/><b>Etes-vous sûr</b> de vouloir révoqurer définitivement ce compte ?", - "REVOKE_IDENTITY_2": "Cette opération est <b>irreversible</b> !<br/><br/>Etes-vous vraiment sûr de vouloir <b>révoqurer définitivement</b> ce compte ?", + "REVOKE_IDENTITY": "Vous allez <b>revoquer définitivement cette identité</b>.<br/><br/>La clé publique et le pseudonyme associés <b>ne pourront plus jamais être utilisés</b> (pour un compte membre). <br/></br/><b>Etes-vous sûr</b> de vouloir révoquer définitivement ce compte ?", + "REVOKE_IDENTITY_2": "Cette opération est <b>irreversible</b> !<br/><br/>Etes-vous vraiment sûr de vouloir <b>révoquer définitivement</b> ce compte ?", "NOT_NEED_RENEW_MEMBERSHIP": "Votre adhésion n'a pas besoin d'être renouvellée (elle n'expirera que dans {{membershipExpiresIn|formatDuration}}).<br/></br/><b>Etes-vous sûr</b> de vouloir renouveler votre adhésion ?", "SAVE_BEFORE_LEAVE": "Voulez-vous <b>sauvegarder vos modifications</b> avant de quitter la page ?", "SAVE_BEFORE_LEAVE_TITLE": "Modifications non enregistrées", diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index c9ae2f44b42b8f4db1f6a01fef6df4f33d22fa2e..c294d77536fb86fbb884e927fd10c8408d6984de 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -52,36 +52,50 @@ function WalletController($scope, $q, $ionicPopup, $timeout, $state, UIUtils, csWallet, $translate, $ionicPopover, Modals, csSettings) { 'ngInject'; - $scope.hasCredit = false; $scope.loading = true; $scope.settings = csSettings.data; $scope.$on('$ionicView.enter', function() { - $scope.loadWallet() - .then(function(walletData) { - $scope.formData = walletData; - $scope.loading=false; // very important, to avoid TX to be display before wallet.currentUd is loaded - $scope.updateView(); - $scope.showQRCode('qrcode', $scope.formData.pubkey, 1100); - $scope.showHelpTip(); - UIUtils.loading.hide(); // loading could have be open (e.g. new account) - }) - .catch(function(err){ - if (err == 'CANCELLED') { - $scope.showHome(); - } - }); + if ($scope.loading) { // load once + $scope.loadWallet() + .then(function(walletData) { + $scope.formData = walletData; + $scope.loading=false; // very important, to avoid TX to be display before wallet.currentUd is loaded + $scope.updateView(); + $scope.showQRCode('qrcode', $scope.formData.pubkey, 1100); + $scope.showHelpTip(); + UIUtils.loading.hide(); // loading could have be open (e.g. new account) + }) + .catch(function(err){ + if (err == 'CANCELLED') { + $scope.showHome(); + } + }); + } }); $scope.updateView = function() { $scope.motion.show({selector: '#wallet .item'}); $scope.$broadcast('$$rebind::' + 'rebind'); // force rebind }; + // Listen new events (can appears from security wizard also) + $scope.$watchCollection('formData.events', function(newEvents, oldEvents) { + if (!oldEvents || $scope.loading || angular.equals(newEvents, oldEvents)) return; + $scope.updateView(); + }); $scope.setRegisterForm = function(registerForm) { $scope.registerForm = registerForm; }; + // Clean controller data when logout + $scope.onWalletLogout = function() { + delete $scope.qrcode; // clean QRcode + delete $scope.formData; + $scope.loading = true; + }; + csWallet.api.data.on.logout($scope, $scope.onWalletLogout); + // Ask uid $scope.showUidPopup = function() { return $q(function(resolve, reject) { @@ -114,7 +128,7 @@ function WalletController($scope, $q, $ionicPopup, $timeout, $state, }) .then(function(uid) { if (!uid) { // user cancel - $scope.formData.uid = null; + delete $scope.formData.uid; UIUtils.loading.hide(); return; } diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 194a710b7d00c253453c13ef4f13d1956a7cb891..7bfe6c6ebbad70c0ea3c0d27b5f4ba76839764df 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -549,7 +549,10 @@ function WotLookupModalController($scope, $controller, $focus, parameters){ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ionicHistory, UIUtils, Modals, csConfig, csWot, csWallet) { 'ngInject'; - $scope.formData = {}; + $scope.formData = { + hasSelf: true + }; + $scope.disableCertifyButton = true; $scope.loading = true; $scope.load = function(pubkey, withCache, uid) { @@ -557,11 +560,13 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $ .then(function(identity){ if (!identity) return UIUtils.onError('ERROR.IDENTITY_NOT_FOUND')().then($scope.showHome); $scope.formData = identity; - $scope.canCertify = $scope.formData.hasSelf && (!csWallet.isLogin() || (!csWallet.isUserPubkey(pubkey))); - $scope.canSelectAndCertify = $scope.formData.hasSelf && csWallet.isUserPubkey(pubkey); + $scope.revoked = identity.requirements && (identity.requirements.revoked || identity.requirements.pendingRevocation); + $scope.canCertify = identity.hasSelf && (!csWallet.isLogin() || (!csWallet.isUserPubkey(pubkey))) && !$scope.revoked; + $scope.canSelectAndCertify = identity.hasSelf && csWallet.isUserPubkey(pubkey); $scope.alreadyCertified = !$scope.canCertify || !csWallet.isLogin() ? false : (!!_.findWhere(identity.received_cert, { pubkey: csWallet.data.pubkey, valid: true }) || !!_.findWhere(identity.received_cert_pending, { pubkey: csWallet.data.pubkey, valid: true })); + $scope.disableCertifyButton = $scope.alreadyCertified || $scope.revoked; $scope.loading = false; }) .catch(function(err) { diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index d4f4fd2f05420609a0b03963138fed7c2c68a55c..e17b1099542029230f78b65307890fb3f017a930 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -396,6 +396,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser idty.willExpireCertificationCount = idty.certifications ? idty.certifications.reduce(function(count, cert){ return count + (cert.expiresIn <= csSettings.data.timeWarningExpire ? 1 : 0); }, 0) : 0; + idty.pendingRevocation = !idty.revoked && !!idty.revocation_sig; data.requirements = idty; data.uid = idty.uid; @@ -690,20 +691,28 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser data.requirements.pendingCertificationCount = 0 ; // init to 0, because not loaded here (see wot-service.js) // Add user events - if (data.requirements.pendingMembership) { - addEvent({type:'pending', message: 'ACCOUNT.WAITING_MEMBERSHIP', context: 'requirements'}); + if (data.requirements.revoked) { + addEvent({type:'warn', message: 'ERROR.WALLET_REVOKED', context: 'requirements'}); } - if (data.requirements.needCertificationCount > 0) { - addEvent({type:'warn', message: 'ACCOUNT.WAITING_CERTIFICATIONS', messageParams: data.requirements, context: 'requirements'}); + else if (data.requirements.pendingRevocation) { + addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'}); } - if (data.requirements.willNeedCertificationCount > 0) { - addEvent({type:'warn', message: 'ACCOUNT.WILL_MISSING_CERTIFICATIONS', messageParams: data.requirements, context: 'requirements'}); - } - if (data.requirements.needRenew) { - addEvent({type:'warn', message: 'ACCOUNT.WILL_NEED_RENEW_MEMBERSHIP', messageParams: data.requirements, context: 'requirements'}); - } - else if (data.requirements.wasMember && data.requirements.needMembership) { - addEvent({type:'warn', message: 'ACCOUNT.NEED_RENEW_MEMBERSHIP', messageParams: data.requirements, context: 'requirements'}); + else { + if (data.requirements.pendingMembership) { + addEvent({type:'pending', message: 'ACCOUNT.WAITING_MEMBERSHIP', context: 'requirements'}); + } + if (data.requirements.needCertificationCount > 0) { + addEvent({type:'warn', message: 'ACCOUNT.WAITING_CERTIFICATIONS', messageParams: data.requirements, context: 'requirements'}); + } + if (data.requirements.willNeedCertificationCount > 0) { + addEvent({type:'warn', message: 'ACCOUNT.WILL_MISSING_CERTIFICATIONS', messageParams: data.requirements, context: 'requirements'}); + } + if (data.requirements.needRenew) { + addEvent({type:'warn', message: 'ACCOUNT.WILL_NEED_RENEW_MEMBERSHIP', messageParams: data.requirements, context: 'requirements'}); + } + else if (data.requirements.wasMember && data.requirements.needMembership) { + addEvent({type:'warn', message: 'ACCOUNT.NEED_RENEW_MEMBERSHIP', messageParams: data.requirements, context: 'requirements'}); + } } }, @@ -1591,12 +1600,12 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser finishLoadRequirements(); // Add user event - addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); + addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'}, 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); + addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'}, true); } else { throw err; @@ -1620,7 +1629,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser addEvent({ type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', - context: 'revocation' + context: 'requirements' }, true); }) .catch(function (err) { @@ -1629,7 +1638,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser addEvent({ type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', - context: 'revocation' + context: 'requirements' }, true); } else { @@ -1638,7 +1647,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser }); } else { - addEvent({type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'revocation'}, true); + addEvent({type: 'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'}, true); } }); diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index e408f6d913254610abcd6fb6b2350b43d60b4609..a324c28ed69c11de4306f82c7d79798c805fe23f 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -109,6 +109,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic } return count; }, 0) : 0; + requirements.pendingRevocation = !requirements.revoked && !!requirements.revocation_sig; return requirements; }) @@ -457,11 +458,18 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic (data.sigQty - data.requirements.certificationCount + data.requirements.willExpireCertificationCount) : 0; data.requirements.pendingCertificationCount = data.received_cert_pending ? data.received_cert_pending.length : 0; + // Use /wot/lookup.revoked when requirements not filled + data.requirements.revoked = angular.isDefined(data.requirements.revoked) ? data.requirements.revoked : data.revoked; + // Add events - if (data.revoked) { + if (data.requirements.revoked) { delete data.hasBadSelfBlock; addEvent(data, {type: 'error', message: 'ERROR.IDENTITY_REVOKED', messageParams: {revocationTime: data.revocationTime}}); - console.debug("[wot] Identity {0} has been revoked".format(data.uid)); + console.debug("[wot] Identity [{0}] has been revoked".format(data.uid)); + } + else if (data.requirements.pendingRevocation) { + addEvent(data, {type:'error', message: 'ERROR.IDENTITY_PENDING_REVOCATION'}); + console.debug("[wot] Identity [{0}] has pending revocation".format(data.uid)); } else if (data.hasBadSelfBlock) { delete data.hasBadSelfBlock; @@ -472,7 +480,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic } else if (data.requirements.expired) { addEvent(data, {type: 'error', message: 'ERROR.IDENTITY_EXPIRED'}); - console.debug("[wot] Identity {0} expired".format(data.uid)); + console.debug("[wot] Identity {0} expired (in sandbox)".format(data.uid)); } else if (data.requirements.willNeedCertificationCount > 0) { addEvent(data, {type: 'error', message: 'INFO.IDENTITY_WILL_MISSING_CERTIFICATIONS', messageParams: data.requirements}); @@ -636,6 +644,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic options = options || {}; options.addUniqueId = angular.isDefined(options.addUniqueId) ? options.addUniqueId : true; options.allowExtension = angular.isDefined(options.allowExtension) ? options.allowExtension : true; + options.excludeRevoked = angular.isDefined(options.excludeRevoked) ? options.excludeRevoked : false; var promise; if (!safeText) { @@ -652,12 +661,14 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic return idties.concat(res.results.reduce(function(idties, res) { return idties.concat(res.uids.reduce(function(uids, idty) { var blocUid = idty.meta.timestamp.split('-', 2); - if (!idty.revoked) { + var revoked = !idty.revoked && idty.revocation_sig; + if (!options.excludeRevoked || !revoked) { return uids.concat({ uid: idty.uid, pubkey: res.pubkey, number: blocUid[0], - hash: blocUid[1] + hash: blocUid[1], + revoked: revoked }); } return uids; diff --git a/www/templates/wot/identity.html b/www/templates/wot/identity.html index e3769763399494fcb7ef306e8c5f540556b959b0..f4d30c6fc5500c018e2e428f0c53fd29ad41ae1d 100644 --- a/www/templates/wot/identity.html +++ b/www/templates/wot/identity.html @@ -25,7 +25,8 @@ </span> <b class="ion-key"></b> {{::identity.pubkey | formatPubkey}} - <span ng-if="!identity.uid" class="assertive" translate>WOT.NOT_MEMBER_PARENTHESIS</span> + <span ng-if="::!identity.uid" class="assertive" translate>WOT.NOT_MEMBER_PARENTHESIS</span> + <span ng-if="::identity.revoked" class="assertive" translate>WOT.IDENTITY_REVOKED_PARENTHESIS</span> </h4> <h4 ng-if="::identity.events||identity.tags"> <span ng-repeat="event in ::identity.events" diff --git a/www/templates/wot/view_certifications.html b/www/templates/wot/view_certifications.html index e36d23a2bee3c78a51c29863013f10f39475eecf..97f7875f9adb50f46b48fc1e57068ba5ab64276d 100644 --- a/www/templates/wot/view_certifications.html +++ b/www/templates/wot/view_certifications.html @@ -17,8 +17,7 @@ <ion-content class="certifications certifications-lg"> <!-- Buttons bar --> - <div class="hidden-xs hidden-sm text-center padding" - ng-if="canCertify || canSelectAndCertify"> + <div class="hidden-xs hidden-sm text-center padding"> <button class="button button-stable button-small-padding icon ion-loop ink" ng-click="doUpdate()" title="{{'COMMON.BTN_REFRESH' | translate}}"> @@ -26,9 +25,9 @@ <button id="helptip-certs-certify" class="button button-raised button-calm icon-left ion-ribbon-b" - ng-if="canCertify" + ng-if="formData.hasSelf" ng-click="certify()" - ng-disabled="alreadyCertified"> + ng-disabled="disableCertifyButton"> {{'WOT.BTN_CERTIFY' | translate}} </button> <button id="helptip-certs-select-certify" @@ -76,7 +75,11 @@ <h5 class="text-center gray"> <i class="icon ion-key"></i> {{formData.pubkey|formatPubkey}} </h5> - <h5 class="assertive" ng-if="(formData.name||formData.uid) && !formData.isMember" translate>WOT.NOT_MEMBER_PARENTHESIS</h5> + <h5 class="assertive"> + <span ng-if="::(formData.name || formData.uid) && !formData.isMember && !revoked" translate>WOT.NOT_MEMBER_PARENTHESIS</span> + <b ng-if="::(formData.name || formData.uid) && !formData.isMember && revoked" translate>WOT.IDENTITY_REVOKED_PARENTHESIS</b> + <b ng-if="::(formData.name || formData.uid) && formData.isMember && revoked" translate>WOT.MEMBER_PENDING_REVOCATION_PARENTHESIS</b> + </h5> </a> </div> <div class="col text-center no-padding gray" style="margin-top: 30px;"> diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index 9911b4d9bfb10d30dc8be07e49b9319b7e5f99ad..1104d02eea176eab35780cfe24f881de7e040c97 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -19,7 +19,12 @@ <h3 class="light" ng-if="::formData.uid">{{::formData.uid}}</h3> <h3 class="light" ng-if="::!formData.uid"><i class="ion-key"></i> {{::formData.pubkey | formatPubkey}}</h3> </ng-if> - <h4 class="assertive"><ng-if ng-if="::(formData.name || formData.uid) && !formData.isMember" translate>WOT.NOT_MEMBER_PARENTHESIS</ng-if></h4> + <h4 class="assertive"> + <ng-if ng-if="::(formData.name || formData.uid) && !formData.isMember && !revoked" translate>WOT.NOT_MEMBER_PARENTHESIS</ng-if> + <ng-if ng-if="::(formData.name || formData.uid) && !formData.isMember && revoked" translate>WOT.IDENTITY_REVOKED_PARENTHESIS</ng-if> + <ng-if ng-if="::(formData.name || formData.uid) && formData.isMember && revoked" translate>WOT.MEMBER_PENDING_REVOCATION_PARENTHESIS</ng-if> + </h4> + </div> <h4 class="content light" ng-if="loading"> <ion-spinner icon="android"></ion-spinner> @@ -49,7 +54,7 @@ ng-click="certify()" ng-if=":rebind:formData.hasSelf" title="{{'WOT.BTN_CERTIFY' | translate}}" - ng-disabled="alreadyCertified"> + ng-disabled="disableCertifyButton"> </button> <button class="button button-calm ink"