]> WPIA git - gigi.git/commitdiff
fix: email + domain ignore case
authorFelix Dörre <felix@dogcraft.de>
Thu, 16 Jun 2016 10:14:54 +0000 (12:14 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 16 Jun 2016 16:50:28 +0000 (18:50 +0200)
fixes #15

Change-Id: I8928aa862393ef7977e91393ae8d91667e790fe8

src/org/cacert/gigi/database/DatabaseConnection.java
src/org/cacert/gigi/database/upgrade/from_10.sql [new file with mode: 0644]
src/org/cacert/gigi/dbObjects/Domain.java
src/org/cacert/gigi/dbObjects/EmailAddress.java

index f1c1c01102e126677e373c42edc864270c512de6..09093669210c3229e9baf8e9ac42968500588660 100644 (file)
@@ -99,7 +99,7 @@ public class DatabaseConnection {
 
     }
 
-    public static final int CURRENT_SCHEMA_VERSION = 10;
+    public static final int CURRENT_SCHEMA_VERSION = 11;
 
     public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
 
diff --git a/src/org/cacert/gigi/database/upgrade/from_10.sql b/src/org/cacert/gigi/database/upgrade/from_10.sql
new file mode 100644 (file)
index 0000000..8bbb6bb
--- /dev/null
@@ -0,0 +1,2 @@
+UPDATE "emails" SET "email" = lower("email");
+UPDATE "domains" SET "domain" = lower("domain");
index 5876530355a8f9d5be1c37aa20f588e40ff37ca2..fa6a6d0e10240b75b37d205c0a33e7645d02980f 100644 (file)
@@ -51,6 +51,7 @@ public class Domain implements IdCachable, Verifyable {
     }
 
     public Domain(User actor, CertificateOwner owner, String suffix) throws GigiApiException {
+        suffix = suffix.toLowerCase();
         synchronized (Domain.class) {
             checkCertifyableDomain(suffix, actor.isInGroup(Group.CODESIGNING));
             this.owner = owner;
index d92338ca9899f0dc8e126159e005e26863cd0b88..04108ea2ec3831284f479ecd186f843d6a7790ee 100644 (file)
@@ -42,6 +42,7 @@ public class EmailAddress implements IdCachable, Verifyable {
     }
 
     public EmailAddress(User owner, String address, Locale mailLocale) throws GigiApiException {
+        address = address.toLowerCase();
         if ( !EmailProvider.MAIL.matcher(address).matches()) {
             throw new IllegalArgumentException("Invalid email.");
         }