[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 422/459: fix credential overwrite
From: |
gnunet |
Subject: |
[reclaim-ui] 422/459: fix credential overwrite |
Date: |
Fri, 11 Jun 2021 23:28:34 +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 4823072f40067cf7b9b8b62539beec1dabd251f8
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Jan 6 13:01:02 2021 +0900
fix credential overwrite
---
.../edit-credentials.component.html | 2 +-
src/app/edit-identity/edit-identity.component.html | 11 ++++--
src/app/edit-identity/edit-identity.component.ts | 39 +++++++++++++---------
src/app/reclaim.service.ts | 3 ++
4 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/src/app/edit-credentials/edit-credentials.component.html
b/src/app/edit-credentials/edit-credentials.component.html
index d45b72c..179a451 100644
--- a/src/app/edit-credentials/edit-credentials.component.html
+++ b/src/app/edit-credentials/edit-credentials.component.html
@@ -28,7 +28,7 @@
</div>
<div class="col-sm"></div>
</div>
- <div class="row"
+ <div class="row mb-1"
[class.alert-danger]="newCredential.name === credential.name"
[class.alert-warning]="!isCredentialValid(credential)" *ngFor="let
credential of credentials">
<div class="col-sm">
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index d0bbb75..006bb71 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -65,14 +65,16 @@
<span class="fa fa-download"></span> {{getMessage("import") }}
</button>
</div>
- <div *ngIf="validImportEmail" class="col-sm alert alert-primary
alert-dismissible show my-2" role="alert" >
+
+ <div *ngIf="validImportEmail && !overwriteRequiresDecision &&
!importBannerDismissed"
+ class="col-sm alert alert-primary alert-dismissible show my-2"
role="alert" >
{{getMessage("edit_identity_html@importInfo", {ISSUERNAME:
getImportIssuerName()})}}<br/>
<i>{{getMessage("Note")}}</i>{{getMessage("edit_credentials_html@linkAccountInfo2")}}
<br/>
<button class="ml-1 btn btn-primary" (click)="import()">
<span class="fa fa-download"></span>
{{getMessage("edit_identity_html@importFrom", {ISSUERNAME:
getImportIssuerName()})}}
</button>
- <button type="button" class="btn btn-primary" (click)="validImportEmail =
false">
+ <button type="button" class="btn btn-primary"
(click)="importBannerDismissed = true">
<span class="fa fa-times"></span> {{ getMessage("Dismiss") }}
</button>
</div>
@@ -297,7 +299,10 @@
<button class="ml-2 btn btn-primary"
(click)="deleteAttribute(claim)">
<span class="fa fa-trash"></span> {{ getMessage("Delete") }}
</button>
-
+ <button class="ml-2 btn btn-primary" (click)="import()"
+ *ngIf="claim.name == 'email' && validImportEmail">
+ <span class="fa fa-download"></span>
{{getMessage("edit_identity_html@importFrom", {ISSUERNAME:
getImportIssuerName()})}}
+ </button>
</div>
</div>
</div>
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index 92fbf78..20eeff3 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -56,6 +56,7 @@ export class EditIdentityComponent implements OnInit {
attributesToOverwriteOnImport: any[] = [];
overwriteRequiresDecision: boolean = false;
validImportEmail: boolean = false;
+ importBannerDismissed: boolean = false;
scopes: Scope[];
newCredential: Credential;
@@ -593,7 +594,24 @@ export class EditIdentityComponent implements OnInit {
this.importIdProvider.name = this.importIdProvider.url.split('//')[1];
}
- tryImportCredential() {
+ private handleLoginResponse(success: any) {
+ if (!success || (null == this.oauthService.getIdToken())) {
+ return;
+ }
+ console.log("Login successful: "+this.oauthService.getIdToken());
+ this.newCredential.name = this.importIdProvider.name + "oidcjwt";
+ this.newCredential.value = this.oauthService.getIdToken();
+ for (let existCred of this.credentials) {
+ if (existCred.name == this.newCredential.name) {
+ this.newCredential.id = existCred.id;
+ console.log("Overwriting credential ID " + this.newCredential.id);
+ break;
+ }
+ }
+ this.importAttributesFromCredential();
+ }
+
+ private tryImportCredential() {
if (this.importIdProvider.url === '') {
console.log("No ID provider flow to pick up from...")
return;
@@ -604,23 +622,11 @@ export class EditIdentityComponent implements OnInit {
this.configureOauthService();
if (!localStorage.getItem("credentialCode")){
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(success => {
- if (!success || (null == this.oauthService.getIdToken())) {
- return;
- }
- console.log("Login successful: "+this.oauthService.getIdToken());
- this.newCredential.name = this.importIdProvider.name + "oidcjwt";
- this.newCredential.value = this.oauthService.getIdToken();
- this.importAttributesFromCredential();
+ this.handleLoginResponse(success);
});
} else {
this.oauthService.loadDiscoveryDocumentAndTryLogin(loginOptions).then(success
=> {
- if (!success || (null == this.oauthService.getIdToken())) {
- return;
- }
- console.log("Login successful: "+this.oauthService.getIdToken());
- this.newCredential.name = this.importIdProvider.name + "oidcjwt";
- this.newCredential.value = this.oauthService.getIdToken();
- this.importAttributesFromCredential();
+ this.handleLoginResponse(success);
});
}
}
@@ -662,6 +668,7 @@ export class EditIdentityComponent implements OnInit {
this.attributesToImport = [];
this.attributesToOverwriteOnImport = [];
this.overwriteRequiresDecision = false;
+ this.importBannerDismissed = true;
localStorage.removeItem('importIdProviderURL');
localStorage.removeItem('emailForCredential');
localStorage.removeItem('credentialCode');
@@ -751,7 +758,7 @@ export class EditIdentityComponent implements OnInit {
if ((this.attributesToOverwriteOnImport.length > 0) &&
this.overwriteRequiresDecision) {
console.log("Wait for user input");
- return;
+ return;
}
this.proceedAttributeImport();
});
diff --git a/src/app/reclaim.service.ts b/src/app/reclaim.service.ts
index 5828b25..49f2191 100644
--- a/src/app/reclaim.service.ts
+++ b/src/app/reclaim.service.ts
@@ -52,6 +52,9 @@ export class ReclaimService {
"value": credential.value,
"type": credential.type
}
+ if ((undefined !==credential.id) && ('' !== credential.id)) {
+ json["id"] = credential.id;
+ }
return this.http.post(this.config.get().apiUrl +
'/reclaim/credential/' + identity.name,
json);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 412/459: quality of life improvements, (continued)
- [reclaim-ui] 412/459: quality of life improvements, gnunet, 2021/06/11
- [reclaim-ui] 399/459: update, gnunet, 2021/06/11
- [reclaim-ui] 424/459: support student bfh addresses, gnunet, 2021/06/11
- [reclaim-ui] 428/459: Merge branch '21-confidential-issue' into 'master', gnunet, 2021/06/11
- [reclaim-ui] 423/459: add spinner, gnunet, 2021/06/11
- [reclaim-ui] 432/459: Translated using Weblate (German), gnunet, 2021/06/11
- [reclaim-ui] 437/459: Added translation using Weblate (Italian), gnunet, 2021/06/11
- [reclaim-ui] 433/459: Translated using Weblate (Portuguese), gnunet, 2021/06/11
- [reclaim-ui] 445/459: Translated using Weblate (Italian), gnunet, 2021/06/11
- [reclaim-ui] 452/459: Translated using Weblate (French), gnunet, 2021/06/11
- [reclaim-ui] 422/459: fix credential overwrite,
gnunet <=
- [reclaim-ui] 458/459: fix: recover properly after failed webfinger, gnunet, 2021/06/11
- [reclaim-ui] 459/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 442/459: Translated using Weblate (Italian), gnunet, 2021/06/11
- [reclaim-ui] 447/459: Translated using Weblate (French), gnunet, 2021/06/11
- [reclaim-ui] 451/459: Translated using Weblate (French), gnunet, 2021/06/11
- [reclaim-ui] 438/459: Added translation using Weblate (Spanish), gnunet, 2021/06/11
- [reclaim-ui] 446/459: Translated using Weblate (French), gnunet, 2021/06/11