Commit 5db2b12c authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] When identity has bas self block, add a button to resend the membership - fix #722

parent d6c1737d
......@@ -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...",
......
......@@ -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...",
......
......@@ -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...",
......
......@@ -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...",
......
......@@ -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à...",
......
......@@ -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");
})
......
......@@ -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];
......
......@@ -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) {
......
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment