Show message when userIds have identical claims

This commit is contained in:
Yarmo Mackenbach 2020-12-14 09:40:09 +01:00
parent 7066c259c4
commit 698ecb2ab3

View file

@ -357,6 +357,8 @@ async function displayProfile(opts) {
return; return;
} }
let primaryClaims
feedback = ""; feedback = "";
if (userMail) { if (userMail) {
verifications.forEach((userId, i) => { verifications.forEach((userId, i) => {
@ -380,6 +382,8 @@ async function displayProfile(opts) {
userId = userId.sort((a,b) => (a.serviceproviderData.serviceprovider.name > b.serviceproviderData.serviceprovider.name) ? 1 : ((b.serviceproviderData.serviceprovider.name > a.serviceproviderData.serviceprovider.name) ? -1 : 0)); userId = userId.sort((a,b) => (a.serviceproviderData.serviceprovider.name > b.serviceproviderData.serviceprovider.name) ? 1 : ((b.serviceproviderData.serviceprovider.name > a.serviceproviderData.serviceprovider.name) ? -1 : 0));
primaryClaims = userId
userId.forEach((claim, i) => { userId.forEach((claim, i) => {
const claimData = claim.serviceproviderData; const claimData = claim.serviceproviderData;
if (!claimData.serviceprovider.name) { if (!claimData.serviceprovider.name) {
@ -423,6 +427,14 @@ async function displayProfile(opts) {
userId = userId.sort((a,b) => (a.serviceproviderData.serviceprovider.name > b.serviceproviderData.serviceprovider.name) ? 1 : ((b.serviceproviderData.serviceprovider.name > a.serviceproviderData.serviceprovider.name) ? -1 : 0)); userId = userId.sort((a,b) => (a.serviceproviderData.serviceprovider.name > b.serviceproviderData.serviceprovider.name) ? 1 : ((b.serviceproviderData.serviceprovider.name > a.serviceproviderData.serviceprovider.name) ? -1 : 0));
if (primaryClaims && primaryClaims.toString() == userId.toString()) {
feedback += `<div class="profileDataItem profileDataItem--noLabel">`;
feedback += `<div class="profileDataItem__label"></div>`;
feedback += `<div class="profileDataItem__value">Identical to primary</div>`;
feedback += `</div>`;
return;
}
userId.forEach((claim, i) => { userId.forEach((claim, i) => {
const claimData = claim.serviceproviderData; const claimData = claim.serviceproviderData;
if (!claimData.serviceprovider.name) { if (!claimData.serviceprovider.name) {