[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 274/459: fix
From: |
gnunet |
Subject: |
[reclaim-ui] 274/459: fix |
Date: |
Fri, 11 Jun 2021 23:26:06 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.
commit 3fed0cfd543f1936f5417a8f8e2df503d3aa57d2
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Fri Aug 7 08:43:14 2020 +0200
fix
---
src/app/identity-list/identity-list.component.html | 5 +-
src/app/identity-list/identity-list.component.ts | 63 ++++++++++------------
2 files changed, 29 insertions(+), 39 deletions(-)
diff --git a/src/app/identity-list/identity-list.component.html
b/src/app/identity-list/identity-list.component.html
index 713b9ff..7f8caf6 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -77,15 +77,14 @@
<div class="alert alert-secondary fade show"
*ngIf="!hasAttributes(identity)">
This identity has no attributes. Maybe try <a class="buttonlink"
[routerLink]="['/edit-identity', identity.name]">adding some?</a>
</div>
- <div *ngIf="isClaimMissing(identity) || isRequestedScopeMissing(identity)"
class="alert alert-danger alert-dismissible fade show" role="alert">
+ <div *ngIf="isAnyRequestedClaimMissing(identity)" class="alert
alert-danger alert-dismissible fade show" role="alert">
<span class="fa fa-openid"></span> This identity is missing some
requested information:
<ul>
<li *ngIf="isProfileRequested() &&
isProfileMissing(identity)">getProfileDescription()</li>
<li *ngIf="isEmailRequested() &&
isEmailMissing(identity)">getEmailDescription()</li>
<li *ngIf="isPhoneRequested() &&
isPhoneMissing(identity)">getPhoneDescription()</li>
<li *ngIf="isAddressRequested() &&
isAddressMissing(identity)">getAddressDescription()</li>
- <li *ngFor="let attr of getMissingClaims(identity)">{{attr}}</li>
- <li *ngFor="let ref of getOptional(identity)">{{ref}} (optional)</li>
+ <li *ngFor="let attr of getMissingClaims(identity)">{{attr}}<i
*ngIf="isOptional(attribute)"> (optional)</i></li>
</ul>
<button class="btn btn-primary" [routerLink]="['/edit-identity',
identity.name]">
<span class="fa fa-plus"></span> Edit identity
diff --git a/src/app/identity-list/identity-list.component.ts
b/src/app/identity-list/identity-list.component.ts
index 9887b6a..0b45f17 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -26,7 +26,6 @@ export class IdentityListComponent implements OnInit {
phoneAttribute: any;
addressAttributes: any;
requestedScopes: any;
- requestedClaims: any;
missingClaims: any;
optionalClaims: any;
attributes: any;
@@ -55,7 +54,6 @@ export class IdentityListComponent implements OnInit {
this.showConfirmDelete = null;
this.requestedScopes = {};
this.missingClaims = {};
- this.requestedClaims = {};
this.optionalClaims = {};
this.connected = false;
this.modalOpened = false;
@@ -131,7 +129,6 @@ export class IdentityListComponent implements OnInit {
private updateAttestations(identity) {
this.attestations[identity.pubkey] = [];
- this.requestedClaims[identity.pubkey] = [];
this.optionalClaims[identity.pubkey] = [];
this.reclaimService.getAttestations(identity).subscribe(attestations => {
if (attestations !== null) {
@@ -163,7 +160,6 @@ export class IdentityListComponent implements OnInit {
private updateAttributes(identity) {
this.reclaimService.getAttributes(identity).subscribe(attributes => {
- this.requestedClaims[identity.pubkey] = [];
this.attributes[identity.pubkey] =
attributes.sort(this.sortAttributeByStandardClaims(this.oidcService.getStandardClaimNames()));
this.updateMissingClaims(identity);
},
@@ -186,7 +182,6 @@ export class IdentityListComponent implements OnInit {
}
loginIdentity(identity) {
- this.oidcService.setAttestations(this.requestedClaims[identity.pubkey]);
this.oidcService.login(identity).subscribe(() => {
console.log('Successfully logged in');
this.authorize();
@@ -240,12 +235,11 @@ export class IdentityListComponent implements OnInit {
this.oidcService.isStandardAddressClaim(attribute)) {
return true;
}
- if (undefined === this.requestedClaims[identity.pubkey]) {
- return false;
- } else {
- return -1 !==
- this.requestedClaims[identity.pubkey].indexOf(attribute);
+ if
(this.oidcService.getRequestedNonStandardClaims().includes(attribute.name)) {
+ return true;
}
+
+ return false;
}
isProfileRequested() {
@@ -366,39 +360,25 @@ export class IdentityListComponent implements OnInit {
return this.isConnected() && 0 != this.identities.length;
}
- isClaimMissing(identity) {
+ isAnyRequestedClaimMissing(identity): boolean {
if (!this.inOpenIdFlow()) {
return false;
}
- if (undefined === this.requestedClaims) {
- return false;
- }
- var claims = this.oidcService.getRequestedClaims();
- for (var i = 0; i < claims.length; i++) {
- if (claims[i][1] === true) {
- var j;
- for (j = 0; j < this.requestedClaims.length; j++) {
- if (claims[i][0] === this.requestedClaims[j].name){
- return true;
- }
+ var claims = this.oidcService.getClaimNamesForRequest();
+ for (var claim of claims) {
+ let found = false;
+ for (let attr of this.getAttributesForIdentity(identity)) {
+ if (claim !== attr.name) {
+ found = true;
+ break;
}
}
- }
- return false;
- }
-
- isAttestedRequested(identity: Identity, attribute: Attribute) {
- if (undefined === this.requestedClaims[identity.pubkey]) {
- return false;
- } else {
- for (var j = 0; j < this.requestedClaims[identity.pubkey].length; j++) {
- if ((attribute.flag === '1') &&
- (attribute.name ===
this.requestedClaims[identity.pubkey][j].name)) {
- return true;
- }
+ if (!found) {
+ console.log(claim + " is missing");
+ return false;
}
- return false;
}
+ return false;
}
isAttestation(attribute: Attribute) {
@@ -427,4 +407,15 @@ export class IdentityListComponent implements OnInit {
return arr;
}
+ isOptional(attr: Attribute): boolean {
+ var claims = this.oidcService.getRequestedClaims();
+ for (let claim of claims) {
+ if ((claim[0] === attr.name) &&
+ (claim[1] === true)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 270/459: improve authz display, (continued)
- [reclaim-ui] 270/459: improve authz display, gnunet, 2021/06/11
- [reclaim-ui] 256/459: fix: ftbfs, gnunet, 2021/06/11
- [reclaim-ui] 261/459: towards cleanup of codebase and fixes, gnunet, 2021/06/11
- [reclaim-ui] 271/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 269/459: mark requested attributes, gnunet, 2021/06/11
- [reclaim-ui] 292/459: update, gnunet, 2021/06/11
- [reclaim-ui] 294/459: add padding, gnunet, 2021/06/11
- [reclaim-ui] 296/459: minor fix, gnunet, 2021/06/11
- [reclaim-ui] 272/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 300/459: fix class on missing non-standard claims display, gnunet, 2021/06/11
- [reclaim-ui] 274/459: fix,
gnunet <=
- [reclaim-ui] 297/459: fix claim processing, gnunet, 2021/06/11
- [reclaim-ui] 299/459: fix claim missing check, gnunet, 2021/06/11
- [reclaim-ui] 306/459: update style, gnunet, 2021/06/11
- [reclaim-ui] 312/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 307/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 279/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 298/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 280/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 277/459: fix style, gnunet, 2021/06/11
- [reclaim-ui] 283/459: fix claim display; better style, gnunet, 2021/06/11