gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 230/459: fix webfinger


From: gnunet
Subject: [reclaim-ui] 230/459: fix webfinger
Date: Fri, 11 Jun 2021 23:25:22 +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 76e7bb87ea1b50ea4a26e3b56e03367ffdc6d83f
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Wed Jul 8 18:01:53 2020 +0200

    fix webfinger
---
 src/app/attestation.service.ts                             | 12 +++++++-----
 src/app/edit-attestations/edit-attestations.component.html |  2 +-
 src/app/edit-attestations/edit-attestations.component.ts   | 14 +++++++++++++-
 src/app/identity-list/identity-list.component.ts           |  2 +-
 src/assets/config.json                                     |  3 +--
 5 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/app/attestation.service.ts b/src/app/attestation.service.ts
index cc7e564..3315d7a 100644
--- a/src/app/attestation.service.ts
+++ b/src/app/attestation.service.ts
@@ -1,19 +1,21 @@
 import { HttpClient, HttpHeaders} from '@angular/common/http';
 import { Injectable } from '@angular/core'
 import { Observable} from 'rxjs';
-import { ConfigService } from './config.service'
 import { AuthConfig } from 'angular-oauth2-oidc';
 import { IdProvider } from './idProvider';
-import { Identity } from './identity';
 
 @Injectable()
 export class AttestationService {
 
-    constructor(private http: HttpClient, private config: ConfigService) {
+    constructor(private http: HttpClient) {
     }
  
     getLink (email: string): Observable<any>{
-        return this.http.get<any>(this.config.get().webfingerUrl + 
'/.well-known/webfinger?resource=acct:' + email);
+        //test
+        if (email.split('@')[1].includes('localhost')){
+            return 
this.http.get<any>('http://localhost:4567/.well-known/webfinger?resource=acct:' 
+ email)
+        }
+        return this.http.get<any>('https://' + email.split('@')[1] + 
'/.well-known/webfinger?resource=acct:' + email);
     }
 
     getOauthConfig(idProvider: IdProvider){
@@ -33,7 +35,7 @@ export class AttestationService {
           // URL of the SPA to redirect the user to after login
           redirectUri: redirectUri,
 
-          postLogoutRedirectUri: window.location.href,
+          postLogoutRedirectUri: redirectUri,
 
           logoutUrl: idProvider.logoutURL + '/logout',
       
diff --git a/src/app/edit-attestations/edit-attestations.component.html 
b/src/app/edit-attestations/edit-attestations.component.html
index c9a91ad..07884e5 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-attestations/edit-attestations.component.html
@@ -51,7 +51,7 @@
           </td>
           <td><div style="min-width: 15em">{{newIdProvider.url}}</div></td>
           <td>
-            <button [disabled]="!canAddAttestation(newAttestation)" class="btn 
btn-primary"  (click)="saveIdProvider()">
+            <button class="btn btn-primary"  (click)="saveIdProvider()">
               <span class="fa fa-plus"></span> 
             </button>
             <button class="btn btn-primary ml-2"  (click)="cancleAdding()">
diff --git a/src/app/edit-attestations/edit-attestations.component.ts 
b/src/app/edit-attestations/edit-attestations.component.ts
index 4e9f39a..4426019 100644
--- a/src/app/edit-attestations/edit-attestations.component.ts
+++ b/src/app/edit-attestations/edit-attestations.component.ts
@@ -38,7 +38,12 @@ export class EditAttestationsComponent implements OnInit {
     this.attestations = [];
     if (this.newIdProvider.url !== ''){
       
this.oauthService.configure(this.attestationService.getOauthConfig(this.newIdProvider));
-      this.oauthService.loadDiscoveryDocumentAndTryLogin().then(res => 
console.log("logged in")).catch(err => console.log(err));
+      this.oauthService.loadDiscoveryDocumentAndTryLogin().then(res => {
+        console.log("ngOnInit: logged in");
+        console.log(res);
+        console.log("Has valid accessToken: " + 
this.oauthService.hasValidAccessToken());
+        console.log("AccessToken: " + this.oauthService.getAccessToken());
+      }).catch(err => console.log(err));
     }
     this.activatedRoute.params.subscribe(p => {
       if (p['id'] === undefined) {
@@ -72,6 +77,13 @@ export class EditAttestationsComponent implements OnInit {
   }
 
   addAttestation() {
+    if (!this.oauthService.hasValidAccessToken()){
+      console.log("No AccessToken");
+      
this.oauthService.configure(this.attestationService.getOauthConfig(this.newIdProvider));
+      this.oauthService.loadDiscoveryDocumentAndTryLogin().then(res => {
+        console.log("AddAttestation: logged in");
+        console.log(this.oauthService.getAccessToken());}).catch(err => 
console.log(err));
+    }
     this.newAttestation.value = this.oauthService.getAccessToken();
     this.reclaimService.addAttestation(this.identity, 
this.newAttestation).subscribe(res => {
       console.log("Saved Attestation");
diff --git a/src/app/identity-list/identity-list.component.ts 
b/src/app/identity-list/identity-list.component.ts
index b3cd33d..b5b233e 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -264,7 +264,7 @@ export class IdentityListComponent implements OnInit {
         this.updateAttributes(identity);
         this.updateAttestations(identity);
       });
-      if (!this.modalOpened) {
+      if (this.modalOpened) {
         this.closeModal('GnunetInfo');
       }
       this.connected = true;
diff --git a/src/assets/config.json b/src/assets/config.json
index f118d56..c46d4fa 100644
--- a/src/assets/config.json
+++ b/src/assets/config.json
@@ -1,4 +1,3 @@
 {
-    "apiUrl": "http://localhost:7776";,
-    "webfingerUrl": "http://localhost:4567";
+    "apiUrl": "http://localhost:7776";
 }

-- 
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]