gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 100/459: warning if identity name already exists


From: gnunet
Subject: [reclaim-ui] 100/459: warning if identity name already exists
Date: Fri, 11 Jun 2021 23:23:12 +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 f0852655a01880cf175e5bdce2b3a93476aa6708
Author: Alexia Pagkopoulou <a.pagkopoulou@tum.de>
AuthorDate: Fri Jun 28 15:57:02 2019 +0200

    warning if identity name already exists
---
 src/app/identity-list/identity-list.component.html | 12 +++++++++++-
 src/app/identity-list/identity-list.component.ts   |  8 ++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/app/identity-list/identity-list.component.html 
b/src/app/identity-list/identity-list.component.html
index ce8fa1f..4f63ff6 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -233,10 +233,19 @@
     <div class="card-avatar-character text-dark">
       Add Identity        </div>
   </div>
+  
+  <!-- Identity creation -->
+  
+  <!-- Invalid input -->
   <div *ngIf="'' !== newIdentity.name && !canSave()" class="alert alert-danger 
alert-dismissible fade show" role="alert">
     Only Alphanumeric input. No spaces or special characters allowed.
   </div>
-  <div *ngIf="'' === newIdentity.name || canSave()" class="alert 
alert-secondary alert-dismissible fade show" role="alert">
+  <!--Identity already exists -->  
+  <div *ngIf="isDuplicate(newIdentity)" class="alert alert-warning 
alert-dismissible fade show" role="alert"> 
+    An identity with this username already exists.
+  </div>
+  <!-- Input text -->
+  <div *ngIf="('' === newIdentity.name || canSave()) && 
!isDuplicate(newIdentity); else invalid_identity_name" class="alert 
alert-secondary alert-dismissible fade show" role="alert">
     Enter a username for your new identity
   </div>
   <div class="card-body">
@@ -251,6 +260,7 @@
     </button>
   </div>
 </div>
+
 <div *ngIf="0 != identities.length && !isAddIdentity() && (null == 
identityInEdit)"  style="margin-top: 1em; text-align: center;">
   <button class="btn btn-primary" (click)="addIdentity()">
     <span class="fa fa-plus"></span> Add identity
diff --git a/src/app/identity-list/identity-list.component.ts 
b/src/app/identity-list/identity-list.component.ts
index d9d1413..9241143 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -160,6 +160,14 @@ export class IdentityListComponent implements OnInit {
 
   isAddIdentity() { return null != this.newIdentity; }
 
+  isDuplicate(identity) 
+  {
+    for (let i = 0; i < this.identities.length; i++) {
+        if (this.identities[i].name === this.newIdentity.name) {
+          return true;
+        }
+    }
+  } 
   canSave()
   {
     if (this.newIdentity.name == null) {

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