diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 163e74215fda97b0238527ada7a506fab4409f7f..8612f6de8d1e1e4dc94b0c6a1336f60096261734 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -470,6 +470,7 @@ "SIG_STOCK": "Stock of certifications to give", "BTN_RECEIVE_MONEY": "Receive", "BTN_SELECT_ALTERNATIVES_IDENTITIES": "Switch to another identity...", + "BTN_FIX_MEMBERSHIP": "Resubmit membership request...", "BTN_MEMBERSHIP_RENEW": "Renew membership", "BTN_MEMBERSHIP_RENEW_DOTS": "Renew membership...", "BTN_MEMBERSHIP_OUT_DOTS": "Revoke membership...", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 8d455d5fc9bed0e8c5a0eacaa7cc89e5c4d098ec..d0ab4d98dfe3176629f8f88711cc2f6cf6b65519 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -470,6 +470,7 @@ "SIG_STOCK": "Stock of certifications to give", "BTN_RECEIVE_MONEY": "Receive", "BTN_SELECT_ALTERNATIVES_IDENTITIES": "Switch to another identity...", + "BTN_FIX_MEMBERSHIP": "Resubmit membership request...", "BTN_MEMBERSHIP_RENEW": "Renew membership", "BTN_MEMBERSHIP_RENEW_DOTS": "Renew membership...", "BTN_MEMBERSHIP_OUT_DOTS": "Revoke membership...", diff --git a/www/i18n/locale-es-ES.json b/www/i18n/locale-es-ES.json index eb09ca109370465c815298c650ea83690b581718..7418e41e31d07b26546fcaed483407615d0115e8 100644 --- a/www/i18n/locale-es-ES.json +++ b/www/i18n/locale-es-ES.json @@ -454,6 +454,7 @@ "SIG_STOCK": "Certificaciones emitidas", "BTN_RECEIVE_MONEY": "Recibir", "BTN_SELECT_ALTERNATIVES_IDENTITIES": "Cambiar a otra identidad...", + "BTN_FIX_MEMBERSHIP": "Volver a enviar la adhesión...", "BTN_MEMBERSHIP_RENEW": "Renovar la adhesión", "BTN_MEMBERSHIP_RENEW_DOTS": "Renovar la adhesión...", "BTN_MEMBERSHIP_OUT_DOTS": "Cancelar la adhesión...", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 7ba68b4e1d30c421b0366bb7643d58d54a42be41..efdc561707c33ebe9331a8e80b6c7d4074fb978a 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -470,6 +470,7 @@ "SIG_STOCK": "Certifications envoyées", "BTN_RECEIVE_MONEY": "Encaisser", "BTN_SELECT_ALTERNATIVES_IDENTITIES": "Basculer vers une autre identité...", + "BTN_FIX_MEMBERSHIP": "Renvoyer la demande d'adhésion...", "BTN_MEMBERSHIP_RENEW": "Renouveler l'adhésion", "BTN_MEMBERSHIP_RENEW_DOTS": "Renouveler l'adhésion...", "BTN_MEMBERSHIP_OUT_DOTS": "Arrêter l'adhésion...", diff --git a/www/i18n/locale-it-IT.json b/www/i18n/locale-it-IT.json index fd900c28b095d4ffa00c8575b0fd3b93d585a95e..b33352b40f8f3fb364a58dff90cf68e02557d883 100644 --- a/www/i18n/locale-it-IT.json +++ b/www/i18n/locale-it-IT.json @@ -458,8 +458,9 @@ "BTN_RECEIVE_MONEY": "Ricevere", "BTN_SELECT_ALTERNATIVES_IDENTITIES": "Usare un'altra identità ..", "BTN_MEMBERSHIP_IN_DOTS": "Registrati come membro..", - "BTN_MEMBERSHIP_RENEW": "Rinnovare certificazione", - "BTN_MEMBERSHIP_RENEW_DOTS": "Rinnovare certificazione ...", + "BTN_FIX_MEMBERSHIP": "Invia nuovamente di adesione...", + "BTN_MEMBERSHIP_RENEW": "Rinnovare adesione", + "BTN_MEMBERSHIP_RENEW_DOTS": "Rinnovare adesione ...", "BTN_MEMBERSHIP_OUT_DOTS": "Revocare adesione...", "BTN_SEND_IDENTITY_DOTS": "Pubblicare identità ...", "BTN_SECURITY_DOTS": "Login e securità ...", diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 0b844f132cd69ca61ed72e76f6fc4959f9e35916..ab394fad50727986f32b5d90974bc06fac08a7e9 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -409,7 +409,9 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, return UIUtils.alert.info("INFO.NOT_NEED_MEMBERSHIP"); } - return wallet.auth() + $scope.hideActionsPopover(); + + return wallet.auth({silent: true}) .then(function() { UIUtils.alert.confirm("CONFIRM.FIX_MEMBERSHIP"); }) diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index 1d402fab1830aa07e4cddc79a86c4a7f0da814e4..3e9050ecae4a53118a0d515781daae9013cf5a19 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -671,13 +671,7 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se // Check if self has been done on a valid block if (!data.isMember && blockNumber !== 0 && blockHash !== block.hash) { - addEvent({type: 'error', message: 'ERROR.WALLET_INVALID_BLOCK_HASH', context: 'requirements'}); - console.debug("Invalid membership for uid={0}: block hash changed".format(data.uid)); - } - // Check if self expired - else if (!data.isMember && data.requirements.expired) { - addEvent({type: 'error', message: 'ERROR.WALLET_IDENTITY_EXPIRED', context: 'requirements'}); - console.debug("Identity expired for uid={0}.".format(data.uid)); + data.requirements.hasBadSelfBlock = true; } }) .catch(function(err){ @@ -720,13 +714,24 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se addEvents = function() { // Add user events if (data.requirements.revoked) { + delete data.requirements.hasBadSelfBlock; addEvent({type:'info', message: 'ERROR.WALLET_REVOKED', context: 'requirements'}); } else if (data.requirements.pendingRevocation) { + delete data.requirements.hasBadSelfBlock; addEvent({type:'pending', message: 'INFO.REVOCATION_SENT_WAITING_PROCESS', context: 'requirements'}); } else { - if (data.requirements.pendingMembership) { + if (!data.isMember && data.requirements.hasBadSelfBlock) { + addEvent({type: 'error', message: 'ERROR.WALLET_INVALID_BLOCK_HASH', context: 'requirements'}); + console.debug("Invalid membership for uid={0}: block hash changed".format(data.uid)); + } + // Check if self expired + else if (!data.isMember && data.requirements.expired) { + addEvent({type: 'error', message: 'ERROR.WALLET_IDENTITY_EXPIRED', context: 'requirements'}); + console.debug("Identity expired for uid={0}.".format(data.uid)); + } + else if (data.requirements.pendingMembership) { addEvent({type:'pending', message: 'ACCOUNT.WAITING_MEMBERSHIP', context: 'requirements'}); } // If user has send a SELF, ask for membership - fix #625 @@ -1455,7 +1460,7 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se return $q.all([ getKeypair(), csCurrency.get(), - csCurrency.blockchain.current() + csCurrency.blockchain.lastValid() ]) // Create identity document .then(function(res) { @@ -1473,7 +1478,10 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se .then(function () { if (!!needToLoadRequirements) { // Refresh membership data (if need) - return loadRequirements(); + return loadRequirements() + + // Add wallet events + .then(addEvents) } else { data.uid = uid; @@ -1497,7 +1505,7 @@ angular.module('cesium.wallet.services', ['ngApi', 'ngFileSaver', 'cesium.bma.se return $q.all([ getKeypair(), - csCurrency.blockchain.current() + csCurrency.blockchain.lastValid() ]) .then(function(res) { var keypair = res[0]; diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index c363877244fbbc208a826a09ec34a401d6ad357f..5852a5360e2f228268170ed91690b0e99832cba8 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -541,7 +541,7 @@ angular.module('cesium.wot.services', ['ngApi', 'cesium.bma.services', 'cesium.c delete data.hasBadSelfBlock; if (!data.isMember) { addEvent(data, {type: 'error', message: 'ERROR.IDENTITY_INVALID_BLOCK_HASH'}); - console.debug("[wot] Invalid membership for {0}: block hash changed".format(data.uid)); + console.debug("[wot] Invalid membership for uid {0}: block hash changed".format(data.uid)); } } else if (data.requirements.expired) { diff --git a/www/templates/wallet/popover_actions.html b/www/templates/wallet/popover_actions.html index 00f24afea27f312e3a3ad844488328e837799971..fa7084450b06789a21571b667fb14ec02171a9d6 100644 --- a/www/templates/wallet/popover_actions.html +++ b/www/templates/wallet/popover_actions.html @@ -29,12 +29,18 @@ {{'ACCOUNT.BTN_MEMBERSHIP_RENEW_DOTS' | translate}} </a> <a class="item item-icon-left ink hidden-xs hidden-sm" - ng-if="!walletData.requirements.needSelf && !walletData.requirements.revoked" + ng-if="!walletData.requirements.needSelf && !walletData.requirements.hasBadSelfBlock && !walletData.requirements.revoked" ng-class="{'gray':!walletData.requirements.needRenew}" ng-click="renewMembership()"> <i class="icon ion-loop"></i> {{'ACCOUNT.BTN_MEMBERSHIP_RENEW_DOTS' | translate}} </a> + <a class="item item-icon-left ink hidden-xs hidden-sm" + ng-if="walletData.requirements.hasBadSelfBlock" + ng-click="fixMembership()"> + <i class="icon ion-loop"></i> + {{'ACCOUNT.BTN_FIX_MEMBERSHIP' | translate}} + </a> <a class="item item-icon-left assertive ink" ng-if="walletData.requirements.canMembershipOut"