gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 103/459: disable button on duplicate ID name


From: gnunet
Subject: [reclaim-ui] 103/459: disable button on duplicate ID name
Date: Fri, 11 Jun 2021 23:23:15 +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 d3b2d4236f055f4b27599bc33327d208d008c50b
Author: Schanzenbach, Martin <mschanzenbach@posteo.de>
AuthorDate: Fri Jun 28 16:34:43 2019 +0200

    disable button on duplicate ID name
---
 src/app/identity-list/identity-list.component.html | 6 +++---
 src/app/identity-list/identity-list.component.ts   | 8 ++++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/app/identity-list/identity-list.component.html 
b/src/app/identity-list/identity-list.component.html
index 1e45db9..0e556db 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -237,15 +237,15 @@
   <!-- Identity creation -->
   
   <!-- Invalid input -->
-  <div *ngIf="'' !== newIdentity.name && !canSave()" class="alert alert-danger 
alert-dismissible fade show" role="alert">
+  <div *ngIf="'' !== newIdentity.name && !canSave() && !isDuplicate()" 
class="alert alert-danger alert-dismissible fade show" role="alert">
     Only Alphanumeric input. No spaces or special characters allowed.
   </div>
   <!--Identity already exists -->  
-  <div *ngIf="isDuplicate(newIdentity)" class="alert alert-warning 
alert-dismissible fade show" role="alert"> 
+  <div *ngIf="isDuplicate()" 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)" class="alert alert-secondary alert-dismissible fade 
show" role="alert">
+  <div *ngIf="'' === newIdentity.name || canSave()" class="alert 
alert-secondary alert-dismissible fade show" role="alert">
     Enter a username for your new identity
   </div>
   <div class="card-body">
diff --git a/src/app/identity-list/identity-list.component.ts 
b/src/app/identity-list/identity-list.component.ts
index 9241143..333ae72 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -160,14 +160,15 @@ export class IdentityListComponent implements OnInit {
 
   isAddIdentity() { return null != this.newIdentity; }
 
-  isDuplicate(identity) 
+  isDuplicate()
   {
     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) {
@@ -179,6 +180,9 @@ export class IdentityListComponent implements OnInit {
     if (!/^[a-zA-Z0-9-]+$/.test(this.newIdentity.name)) {
       return false;
     }
+    if (this.isDuplicate()) {
+      return false;
+    }
     return true;
   }
 

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