Skip to content

Commit

Permalink
add a reminder for certification parameters, delays mostly.
Browse files Browse the repository at this point in the history
  • Loading branch information
matograine committed Nov 14, 2021
1 parent d8c6bab commit 4ac1381
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 41 deletions.
3 changes: 2 additions & 1 deletion www/i18n/locale-fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@
"SAVE_BEFORE_LEAVE_TITLE": "Modifications non enregistrées",
"LOGOUT": "Êtes-vous sûr de vouloir vous déconnecter ?",
"USE_FALLBACK_NODE": "Nœud <b>{{old}}</b> injoignable ou adresse invalide.<br/><br/>Voulez-vous temporairement utiliser le nœud <b>{{new}}</b> ?",
"ISSUE_524_SEND_LOG": "La transaction a été rejetée, à cause d'une anomalie connue (ticket #524) mais <b>non reproduite</b>.<br/><br/>Pour aider les développeurs à corriger cette erreur, <b>acceptez-vous la transmission de vos logs</b> par message ?<br/><small>(aucune donnée confidentielle n'est envoyée)</small>."
"ISSUE_524_SEND_LOG": "La transaction a été rejetée, à cause d'une anomalie connue (ticket #524) mais <b>non reproduite</b>.<br/><br/>Pour aider les développeurs à corriger cette erreur, <b>acceptez-vous la transmission de vos logs</b> par message ?<br/><small>(aucune donnée confidentielle n'est envoyée)</small>.",
"SHORT_LICENSE_REMINDER": "<p>Rappel des paramètres de certification.</p><p>- Chaque membre peut avoir émis 100 certifications valides au maximum.</p><p>- Les certifications sont enregistrées à un intervalle de 5 jours.</p><p>- Une nouvelle identité membre doit réunir au minimum 5 certifications en moins de deux mois.</p><p>- Un membre doit renouveler son adhésion chaque année.</p><p>- Les certifications sont valides durant deux ans.</p>"
},
"MODE": {
"DEMO": {
Expand Down
96 changes: 56 additions & 40 deletions www/js/controllers/wot-controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,25 +788,33 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
// Certification checklist before confirmation
let answers_are_right = $q.defer();
answers_are_right.promise.then(function(){
UIUtils.loading.show();
wallet.certify($scope.formData.uid,
$scope.formData.pubkey,
$scope.formData.blockUid || ($scope.formData.requirements && $scope.formData.requirements.meta && $scope.formData.requirements.meta.timestamp),
$scope.formData.requirements && $scope.formData.requirements.meta && $scope.formData.requirements.meta.sig,
$scope.formData.isMember,
$scope.formData.wasMember)
.then(function(cert) {
UIUtils.loading.hide();
if (cert) {
$scope.prepareNewCert(wallet, cert);
$scope.alreadyCertified = true;
UIUtils.toast.show('INFO.CERTIFICATION_DONE');
$scope.formData.received_cert_pending.unshift(cert);
$scope.formData.requirements.pendingCertificationCount++;
$scope.doMotion();
}
})
.catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED'));
UIUtils.alert.confirm('CONFIRM.SHORT_LICENSE_REMINDER', 'CONFIRM.POPUP_TITLE', {
cssClass: 'positive',
okText: 'COMMON.BTN_OK',
okType: 'button-positive'
})
.then(function(confirm){
if (! confirm) {return}
UIUtils.loading.show();
wallet.certify($scope.formData.uid,
$scope.formData.pubkey,
$scope.formData.blockUid || ($scope.formData.requirements && $scope.formData.requirements.meta && $scope.formData.requirements.meta.timestamp),
$scope.formData.requirements && $scope.formData.requirements.meta && $scope.formData.requirements.meta.sig,
$scope.formData.isMember,
$scope.formData.wasMember)
.then(function(cert) {
UIUtils.loading.hide();
if (cert) {
$scope.prepareNewCert(wallet, cert);
$scope.alreadyCertified = true;
UIUtils.toast.show('INFO.CERTIFICATION_DONE');
$scope.formData.received_cert_pending.unshift(cert);
$scope.formData.requirements.pendingCertificationCount++;
$scope.doMotion();
}
})
.catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED'));
})
})
.catch(
UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET')
Expand Down Expand Up @@ -898,29 +906,37 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
// Certification checklist before confirmation
let answers_are_right = $q.defer();
answers_are_right.promise.then(function(){
UIUtils.loading.show();
// Send certification
wallet.certify(identity.uid,
identity.pubkey,
identity.blockUid || (identity.requirements && identity.requirements.meta && identity.requirements.meta.timestamp),
identity.requirements && identity.requirements.meta && identity.requirements.meta.sig,
identity.isMember,
identity.wasMember)
.then(function (cert) {
UIUtils.loading.hide();
if (!cert) return;
return csWot.extendAll([cert], 'pubkey')
.then(function () {
UIUtils.toast.show('INFO.CERTIFICATION_DONE');
$scope.formData.given_cert_pending.unshift(cert);
$scope.doMotion();
});
})
UIUtils.alert.confirm('CONFIRM.SHORT_LICENSE_REMINDER', 'CONFIRM.POPUP_TITLE', {
cssClass: 'positive',
okText: 'COMMON.BTN_OK',
okType: 'button-positive'
})
.then(function(confirm){
if (! confirm) {return}
UIUtils.loading.show();
// Send certification
wallet.certify(identity.uid,
identity.pubkey,
identity.blockUid || (identity.requirements && identity.requirements.meta && identity.requirements.meta.timestamp),
identity.requirements && identity.requirements.meta && identity.requirements.meta.sig,
identity.isMember,
identity.wasMember)
.then(function (cert) {
UIUtils.loading.hide();
if (!cert) return;
return csWot.extendAll([cert], 'pubkey')
.then(function () {
UIUtils.toast.show('INFO.CERTIFICATION_DONE');
$scope.formData.given_cert_pending.unshift(cert);
$scope.doMotion();
});
})
.catch(UIUtils.onError('ERROR.SEND_CERTIFICATION_FAILED'));
})
.catch(
UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET')
);
})
.catch(
UIUtils.onError('ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET')
);

// Display cert checklist modal
return Modals.showCertificationCheckList({
Expand Down

0 comments on commit 4ac1381

Please sign in to comment.