Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Cesium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Cesium-grp
Cesium
Commits
2d120a65
Commit
2d120a65
authored
3 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
reformat common cert verification
parent
c63120f3
No related branches found
No related tags found
1 merge request
!638
Certification : add questions before validation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
www/js/controllers/wot-controllers.js
+36
-53
36 additions, 53 deletions
www/js/controllers/wot-controllers.js
with
36 additions
and
53 deletions
www/js/controllers/wot-controllers.js
+
36
−
53
View file @
2d120a65
...
...
@@ -759,33 +759,9 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
/* MATOGRAINE FROM HERE WE CAN GROUP IN ONE CERTIFY FUNCTION */
// Check identity not expired
if
(
$scope
.
formData
.
requirements
.
expired
)
{
UIUtils
.
alert
.
error
(
'
ERROR.IDENTITY_EXPIRED
'
);
return
;
}
console
.
log
(
"
formData :
"
,
$scope
.
formData
)
// Check not already certified
var
previousCert
=
_
.
find
(
$scope
.
formData
.
received_cert
,
function
(
cert
)
{
// MATOGRAINE "cert" here is an element from received certs list.
return
cert
.
pubkey
===
wallet
.
data
.
pubkey
&&
cert
.
valid
&&
cert
.
expiresIn
>
csSettings
.
data
.
timeWarningExpire
;
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
;
}
// Check no pending certification
previousCert
=
_
.
findWhere
(
$scope
.
formData
.
received_cert_pending
,
{
pubkey
:
wallet
.
data
.
pubkey
,
valid
:
true
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY_PENDING
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
;
}
$scope
.
commonCertificationVerifications
(
$scope
.
formData
,
wallet
)
// Certification checklist before confirmation
let
answers_are_right
=
$q
.
defer
();
...
...
@@ -857,6 +833,38 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
});
};
$scope
.
commonCertificationVerifications
=
function
(
receiver_idty
,
sender_wallet
)
{
// Check identity not expired
if
(
receiver_idty
.
requirements
.
expired
)
{
UIUtils
.
alert
.
error
(
'
ERROR.IDENTITY_EXPIRED
'
);
return
false
;
}
// Check not already certified
var
previousCert
=
_
.
find
(
receiver_idty
.
received_cert
,
function
(
cert
)
{
return
cert
.
pubkey
===
sender_wallet
.
data
.
pubkey
&&
cert
.
valid
&&
cert
.
expiresIn
>
csSettings
.
data
.
timeWarningExpire
;
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
false
;
}
// Check no pending certification
previousCert
=
_
.
findWhere
(
receiver_idty
.
received_cert_pending
,
{
pubkey
:
sender_wallet
.
data
.
pubkey
,
valid
:
true
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY_PENDING
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
false
;
}
return
true
;
}
// Select an identity and certify
$scope
.
selectAndCertify
=
function
()
{
...
...
@@ -901,34 +909,9 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
}
/* MATOGRAINE FROM HERE WE CAN GROUP IN ONE CERTIFY FUNCTION */
console
.
log
(
"
identity :
"
,
identity
)
// Check identity not expired
if
(
identity
.
requirements
.
expired
)
{
UIUtils
.
alert
.
error
(
'
ERROR.IDENTITY_EXPIRED
'
);
return
;
}
// Check not already certified
var
previousCert
=
_
.
find
(
$scope
.
formData
.
received_cert
,
function
(
cert
)
{
return
cert
.
pubkey
===
wallet
.
data
.
pubkey
&&
cert
.
valid
&&
cert
.
expiresIn
>
csSettings
.
data
.
timeWarningExpire
;
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
;
}
// Check not pending certification
previousCert
=
_
.
findWhere
(
identity
.
received_cert_pending
,
{
pubkey
:
wallet
.
data
.
pubkey
,
valid
:
true
});
if
(
previousCert
)
{
$translate
(
'
ERROR.IDENTITY_ALREADY_CERTIFY_PENDING
'
,
previousCert
)
.
then
(
function
(
message
)
{
UIUtils
.
alert
.
error
(
message
,
'
ERROR.UNABLE_TO_CERTIFY_TITLE
'
);
});
return
;
}
$scope
.
commonCertificationVerifications
(
identity
,
wallet
)
// Certification checklist before confirmation
let
answers_are_right
=
$q
.
defer
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment