[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 371/459: attribute import done
From: |
gnunet |
Subject: |
[reclaim-ui] 371/459: attribute import done |
Date: |
Fri, 11 Jun 2021 23:27:43 +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 1f678029409df0f3b5ee16f7ff25ec8788072642
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Dec 25 18:54:51 2020 +0900
attribute import done
---
src/app/credential.service.ts | 4 +--
src/app/edit-identity/edit-identity.component.html | 3 ++
.../import-attributes.component.ts | 37 ++++++++++++++++------
src/assets/config.json | 2 +-
4 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/src/app/credential.service.ts b/src/app/credential.service.ts
index edeaae0..699324f 100644
--- a/src/app/credential.service.ts
+++ b/src/app/credential.service.ts
@@ -22,8 +22,8 @@ export class CredentialService {
getOauthConfig(idProvider: IdProvider, scopes: Scope[]){
var redirectUri;
if (window.location.href.includes('localhost')){
- const user = localStorage.getItem('userForAttestation');
- redirectUri = 'http://localhost:4200/edit-credentials/' + user;
+ const user = localStorage.getItem('userForCredential');
+ redirectUri = 'http://localhost:4200/import-attributes/' + user;
}
else {
redirectUri = "https://ui.reclaim";
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index 716bb4e..a5b8e83 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -363,6 +363,9 @@
<span class="fa fa-openid"></span>
{{ getMessage("edit_identity_html@manageCreds") }}
</button>
+ <button *ngIf="!inOpenIdFlow() && isExperimental()" class="btn
btn-primary" [routerLink]="['/import-attributes', identity.name ]"
[style.float]="'right'">
+ <span class="fa fa-download"></span>
{{getMessage("edit_identity_html@linkAccount")}}
+ </button>
</div>
</div>
</div>
diff --git a/src/app/import-attributes/import-attributes.component.ts
b/src/app/import-attributes/import-attributes.component.ts
index e036681..b6c8a00 100644
--- a/src/app/import-attributes/import-attributes.component.ts
+++ b/src/app/import-attributes/import-attributes.component.ts
@@ -61,7 +61,13 @@ export class ImportAttributesComponent implements OnInit {
}
this.configureOauthService();
if (!localStorage.getItem("credentialCode")){
- this.oauthService.loadDiscoveryDocumentAndTryLogin();
+ this.oauthService.loadDiscoveryDocumentAndTryLogin().then(success => {
+ console.log("Login successful: "+this.oauthService.getIdToken());
+ this.newCredential.name = this.newIdProvider.name + "oidcjwt";
+ this.newCredential.value = this.oauthService.getIdToken();
+ this.importAttributesFromCredential();
+ });
+
}
else{
this.oauthService.loadDiscoveryDocumentAndTryLogin(loginOptions).then(success
=> {
@@ -114,21 +120,34 @@ export class ImportAttributesComponent implements OnInit {
console.log("Trying to import " + cred.attributes.length + "
attributes");
for (var attr of cred.attributes) {
+ if ((attr.name == "sub") ||
+ (attr.name == "nonce") ||
+ (attr.name == "email_verified") ||
+ (attr.name == "phone_number_verified")) {
+ continue;
+ }
//New attribute with name == claim name
- var attestation = new Attribute(attr.name, '', cred.id, attr.id,
'STRING', '1');
- promises = promises.concat (this.storeAttribute(attestation));
+ var attestation = new Attribute(attr.name, '', cred.id, attr.name,
'STRING', '1');
+ promises.push(
+ from(this.reclaimService.addAttribute(this.identity,
attestation)));
+ //promises = promises.concat (this.storeAttribute(attestation));
}
- forkJoin(promises).pipe(
- finalize(() => {
- //FIXME cleanup
- }))
+ forkJoin(promises)
+ .pipe(
+ finalize(() => {
+ this.newIdProvider.url = '';
+ this.newIdProvider.name = '';
+ localStorage.removeItem('newIdProviderURL');
+ localStorage.removeItem("credentialCode");
+ this.oauthService.logOut();
+ })
+ )
.subscribe(res => {
this.router.navigate(['/edit-identity', this.identity.name]);
},
err => {
console.log(err);
- EMPTY
- });;
+ });
});
});
}
diff --git a/src/assets/config.json b/src/assets/config.json
index 9245d6d..4c424c6 100644
--- a/src/assets/config.json
+++ b/src/assets/config.json
@@ -1,4 +1,4 @@
{
"apiUrl": "http://localhost:7776",
- "experiments": false
+ "experiments": true
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 349/459: fix translations, (continued)
- [reclaim-ui] 349/459: fix translations, gnunet, 2021/06/11
- [reclaim-ui] 387/459: update, gnunet, 2021/06/11
- [reclaim-ui] 358/459: clean up, gnunet, 2021/06/11
- [reclaim-ui] 386/459: fix import for browser plugin, other import may be broken, gnunet, 2021/06/11
- [reclaim-ui] 394/459: fix default selection, gnunet, 2021/06/11
- [reclaim-ui] 369/459: add code for straight attribute import, gnunet, 2021/06/11
- [reclaim-ui] 407/459: use share icon, gnunet, 2021/06/11
- [reclaim-ui] 397/459: fix address handling, gnunet, 2021/06/11
- [reclaim-ui] 406/459: allow authorization from edit component, gnunet, 2021/06/11
- [reclaim-ui] 376/459: updatte attribute info, gnunet, 2021/06/11
- [reclaim-ui] 371/459: attribute import done,
gnunet <=
- [reclaim-ui] 404/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 368/459: settings page, experiments tweaks, gnunet, 2021/06/11
- [reclaim-ui] 395/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 382/459: style adjustments, gnunet, 2021/06/11
- [reclaim-ui] 373/459: fix credential string lowercase, gnunet, 2021/06/11
- [reclaim-ui] 393/459: display all missing claims, gnunet, 2021/06/11
- [reclaim-ui] 380/459: quality of life improvements, gnunet, 2021/06/11
- [reclaim-ui] 383/459: better credential selection, gnunet, 2021/06/11
- [reclaim-ui] 396/459: relax attribute requirements, gnunet, 2021/06/11
- [reclaim-ui] 388/459: significantly simplify identity edit, gnunet, 2021/06/11