gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[reclaim-ui] 197/459: link to fhg account


From: gnunet
Subject: [reclaim-ui] 197/459: link to fhg account
Date: Fri, 11 Jun 2021 23:24:49 +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 f21dd73bb5d61890fd522bb77b190cd20f06e4b7
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Mon May 18 14:41:31 2020 +0200

    link to fhg account
---
 src/app/edit-identity/edit-identity.component.html | 10 ++++++++--
 src/app/edit-identity/edit-identity.component.ts   | 23 +++++++++++++++++++---
 src/app/id-provider.ts                             | 11 -----------
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/app/edit-identity/edit-identity.component.html 
b/src/app/edit-identity/edit-identity.component.html
index beeedf5..80016f2 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -142,7 +142,8 @@
       </ul>
     </div>
 
-    <div class="input-group my-2 col-lg-4">
+    <!--IdProvider-Discovery-->
+    <div *ngIf="!idProviderFound()" class="input-group my-2 col-lg-4">
       <div class="input-group-prepend">
         <span class="input-group-text">@</span>
       </div>
@@ -156,10 +157,15 @@
     <div *ngIf="!emailNotFoundAlertClosed" class="alert alert-danger 
alert-dismissible fade show my-2" role="alert">
       <span class="fa fa-warning"></span> No account found with email: 
{{webfingerEmail}}
     </div>
-    <button *ngIf="isExperimental()" class="btn btn-primary mb-4 fhg-link" 
(click)="getFhGAttestation()">
+    <button *ngIf="isExperimental() && !idProviderFound()" class="btn 
btn-primary mb-4 fhg-link" (click)="getFhGAttestation()">
       <span class="fa fa-user"></span> Link Fraunhofer Account
     </button>
 
+    <!--Link account-->
+    <button *ngIf="isExperimental() && idProviderFound()" class="btn 
btn-primary mb-4 fhg-link" (click)="loginFhgAccount()">
+      <span class="fa fa-user"></span> Link {{getIdProviderName()}} Account
+    </button>
+
     
     <hr/>
 
diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index 5a71fe4..811bf20 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -11,7 +11,6 @@ import { IdentityService } from '../identity.service';
 import { finalize } from 'rxjs/operators';
 import { from, forkJoin, EMPTY } from 'rxjs';
 import {WebfingerService} from '../webfinger.service';
-import { IdProvider } from '../id-provider'
 
 @Component({
   selector: 'app-edit-identity',
@@ -32,7 +31,7 @@ export class EditIdentityComponent implements OnInit {
   requestedAttested: Attribute[];
   optionalAttested: Attribute[];
   webfingerEmail: string;
-  idProvider: IdProvider;
+  idProvider: string;
   emailNotFoundAlertClosed: boolean;
 
   constructor(private reclaimService: ReclaimService,
@@ -50,6 +49,7 @@ export class EditIdentityComponent implements OnInit {
     this.optionalAttested = [];
     this.attestationValues = {};
     this.webfingerEmail = '';
+    this.idProvider = localStorage.getItem('idProvider');
     this.emailNotFoundAlertClosed = true;
     this.identity = new Identity('','');
     this.newAttribute = new Attribute('', '', '', '', 'STRING', '');
@@ -624,7 +624,9 @@ export class EditIdentityComponent implements OnInit {
     localStorage.setItem('userForAttestation', this.identity.name);
     this.isValidEmailforDiscovery();
     this.webfingerService.getLink(this.webfingerEmail).subscribe (idProvider 
=> {
-      this.idProvider = idProvider;
+      this.idProvider = (idProvider.links [0]).href;
+      localStorage.setItem('idProvider', this.idProvider);
+      console.log(this.idProvider);
     },
     error => {
       if (error.status == 404){
@@ -643,6 +645,21 @@ export class EditIdentityComponent implements OnInit {
     return true;
   }
 
+  idProviderFound(){
+    if (this.idProvider == null){
+      return false;
+    }
+    return true;
+  }
+
+  getIdProviderName(){
+    return this.idProvider.split('//')[1];
+  }
+
+  loginFhgAccount(){
+    window.location.href= this.idProvider + '/api/login';
+  }
+
   setExperimental(set) {
     if (set) {
       localStorage.setItem('reclaimExperiments', 'enabled');
diff --git a/src/app/id-provider.ts b/src/app/id-provider.ts
deleted file mode 100644
index 77912e1..0000000
--- a/src/app/id-provider.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export interface IdProvider{
-    subject: string;
-    properties: {
-        "http://schema.org/name": string; 
-    }
-    links: {
-        rel: string;
-        href: string;
-    }
-
-}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]