aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2020-12-30 15:44:04 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2020-12-30 15:44:04 +0900
commit93e28b3da45faba3141265fe4b9f8f679a710513 (patch)
tree40cd73ebd8e966c9d9afa10dd4ce5a3d2843e13c
parent4c9e10a2323744c36ba1725ec4db75d29383d2cb (diff)
downloadreclaim-ui-93e28b3da45faba3141265fe4b9f8f679a710513.tar.gz
reclaim-ui-93e28b3da45faba3141265fe4b9f8f679a710513.zip
fix
-rw-r--r--src/app/edit-identity/edit-identity.component.html8
-rw-r--r--src/app/edit-identity/edit-identity.component.ts63
-rw-r--r--src/locales/en/messages.json1
3 files changed, 37 insertions, 35 deletions
diff --git a/src/app/edit-identity/edit-identity.component.html b/src/app/edit-identity/edit-identity.component.html
index 39d7f15..5368cce 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -138,10 +138,10 @@
138 {{claim.value}} <i>({{claim.name}})</i> 138 {{claim.value}} <i>({{claim.name}})</i>
139 </option> 139 </option>
140 </select> 140 </select>
141 </div> 141 <div class="alert alert-warning"
142 <div class="alert alert-warning" 142 *ngIf="(credentials.length == 0) && isClaimCredentialRequested(newRequestedAttribute)">
143 *ngIf="(credentials.length == 0) && isClaimCredentialRequested(newRequestedAttribute)"> 143 {{ getMessage("edit_identity_html@credentialRequested") }}
144 {{ getMessage("edit_identity_html@selfissued") }} 144 </div>
145 </div> 145 </div>
146 <div style="float:right;" *ngIf="credentials.length > 0"> 146 <div style="float:right;" *ngIf="credentials.length > 0">
147 <select class="custom-select" 147 <select class="custom-select"
diff --git a/src/app/edit-identity/edit-identity.component.ts b/src/app/edit-identity/edit-identity.component.ts
index df71408..2de41e0 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -91,7 +91,6 @@ export class EditIdentityComponent implements OnInit {
91 if (ids[i].name == p['id']) { 91 if (ids[i].name == p['id']) {
92 this.identity = ids[i]; 92 this.identity = ids[i];
93 this.updateAttributes(); 93 this.updateAttributes();
94 this.updateCredentials();
95 } 94 }
96 } 95 }
97 }); 96 });
@@ -167,36 +166,39 @@ export class EditIdentityComponent implements OnInit {
167 166
168 private updateAttributes() { 167 private updateAttributes() {
169 this.reclaimService.getAttributes(this.identity).subscribe(attributes => { 168 this.reclaimService.getAttributes(this.identity).subscribe(attributes => {
170 this.existingProfileClaims = this.bootstrapClaimArray (this.oidcService.getStandardProfileClaims()); 169 this.reclaimService.getCredentials(this.identity).subscribe(credentials => {
171 this.existingEmailClaims = this.bootstrapClaimArray (this.oidcService.getStandardEmailClaims()); 170 this.credentials = credentials;
172 this.existingPhoneClaims = this.bootstrapClaimArray (this.oidcService.getStandardPhoneClaims()); 171 this.existingProfileClaims = this.bootstrapClaimArray (this.oidcService.getStandardProfileClaims());
173 this.existingAddressClaims = this.bootstrapClaimArray (this.oidcService.getStandardAddressClaims()); 172 this.existingEmailClaims = this.bootstrapClaimArray (this.oidcService.getStandardEmailClaims());
174 this.existingNonStandardClaims = []; 173 this.existingPhoneClaims = this.bootstrapClaimArray (this.oidcService.getStandardPhoneClaims());
175 this.attributes = this.sortAttributes(attributes); 174 this.existingAddressClaims = this.bootstrapClaimArray (this.oidcService.getStandardAddressClaims());
176 for (let attr of this.attributes) { 175 this.existingNonStandardClaims = [];
177 if (this.oidcService.isStandardProfileClaim(attr)) { 176 this.attributes = this.sortAttributes(attributes);
178 this.existingProfileClaims = this.updateClaimArray(this.existingProfileClaims, attr); 177 for (let attr of this.attributes) {
179 } else if (this.oidcService.isStandardEmailClaim(attr)) { 178 if (this.oidcService.isStandardProfileClaim(attr)) {
180 this.existingEmailClaims = this.updateClaimArray(this.existingEmailClaims, attr); 179 this.existingProfileClaims = this.updateClaimArray(this.existingProfileClaims, attr);
181 } else if (this.oidcService.isStandardAddressClaim(attr)) { 180 } else if (this.oidcService.isStandardEmailClaim(attr)) {
182 this.existingAddressClaims = this.updateClaimArray(this.existingAddressClaims, attr); 181 this.existingEmailClaims = this.updateClaimArray(this.existingEmailClaims, attr);
183 } else if (this.oidcService.isStandardPhoneClaim(attr)) { 182 } else if (this.oidcService.isStandardAddressClaim(attr)) {
184 this.existingPhoneClaims = this.updateClaimArray(this.existingPhoneClaims, attr); 183 this.existingAddressClaims = this.updateClaimArray(this.existingAddressClaims, attr);
185 } else { 184 } else if (this.oidcService.isStandardPhoneClaim(attr)) {
186 this.existingNonStandardClaims.push(attr); 185 this.existingPhoneClaims = this.updateClaimArray(this.existingPhoneClaims, attr);
186 } else {
187 this.existingNonStandardClaims.push(attr);
188 }
187 } 189 }
188 } 190 this.existingProfileClaims = this.cleanupClaimArray(this.existingProfileClaims);
189 this.existingProfileClaims = this.cleanupClaimArray(this.existingProfileClaims); 191 this.existingEmailClaims = this.cleanupClaimArray(this.existingEmailClaims);
190 this.existingEmailClaims = this.cleanupClaimArray(this.existingEmailClaims); 192 this.existingPhoneClaims = this.cleanupClaimArray(this.existingPhoneClaims);
191 this.existingPhoneClaims = this.cleanupClaimArray(this.existingPhoneClaims); 193 this.existingAddressClaims = this.cleanupClaimArray(this.existingAddressClaims);
192 this.existingAddressClaims = this.cleanupClaimArray(this.existingAddressClaims); 194 this.updateMissingAttributes();
193 this.updateMissingAttributes(); 195 this.validateEmailForImport();
194 this.validateEmailForImport(); 196 this.resetAttributes();
195 this.resetAttributes(); 197 },
196 }, 198 err => {
197 err => { 199 //this.errorInfos.push("Error retrieving attributes for ``" + identity.name + "''");
198 //this.errorInfos.push("Error retrieving attributes for ``" + identity.name + "''"); 200 console.log(err);
199 console.log(err); 201 });
200 }); 202 });
201 } 203 }
202 204
@@ -661,7 +663,6 @@ export class EditIdentityComponent implements OnInit {
661 this.importInProgress = false; 663 this.importInProgress = false;
662 this.oauthService.logOut(); 664 this.oauthService.logOut();
663 this.updateAttributes(); 665 this.updateAttributes();
664 this.updateCredentials();
665 }) 666 })
666 ).subscribe(res => { 667 ).subscribe(res => {
667 console.log("Finished attribute import."); 668 console.log("Finished attribute import.");
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 4e8a1fa..617df70 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -57,6 +57,7 @@
57 "edit_identity_html@addRequestedMissingClaim": "Requested but missing attributes:", 57 "edit_identity_html@addRequestedMissingClaim": "Requested but missing attributes:",
58 "edit_identity_html@importInfo": "Your email address indicates that you may be able to import attributes from an external account at ``{{ISSUERNAME}}´´.", 58 "edit_identity_html@importInfo": "Your email address indicates that you may be able to import attributes from an external account at ``{{ISSUERNAME}}´´.",
59 "edit_identity_html@linkAccount": "Import attributes", 59 "edit_identity_html@linkAccount": "Import attributes",
60 "edit_identity_html@credentialRequired": "This attribute requires an attestation but you do not have any credentials.",
60 "edit_identity_html@standardScopes": "The attributes below correspond to the standard scopes of the\nOpenID Connect specification: ``profile'', ``email'', ``phone'' and ``address''.", 61 "edit_identity_html@standardScopes": "The attributes below correspond to the standard scopes of the\nOpenID Connect specification: ``profile'', ``email'', ``phone'' and ``address''.",
61 "edit_identity_html@selfissued": "Self-issued", 62 "edit_identity_html@selfissued": "Self-issued",
62 "edit_identity_html@importFrom": "Try import from ``{{ISSUERNAME}}´´", 63 "edit_identity_html@importFrom": "Try import from ``{{ISSUERNAME}}´´",