]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/Domain.java
fix: display verify information only when verification token is known.
[gigi.git] / src / org / cacert / gigi / dbObjects / Domain.java
index 3ecf728567f6c166aa5dc960091c8c26061c6f28..f7c963c9e40e83c1033943d0d5d6f3004ac5add2 100644 (file)
@@ -125,6 +125,14 @@ public class Domain implements IdCachable, Verifyable {
         configs = null;
     }
 
+    public synchronized boolean isVerifyable(String hash) throws GigiApiException {
+        try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT 1 FROM `domainPinglog` WHERE `challenge`=? AND `state`='open' AND `configId` IN (SELECT `id` FROM `pingconfig` WHERE `domainid`=? AND `type`='email')")) {
+            ps.setString(1, hash);
+            ps.setInt(2, id);
+            return ps.executeQuery().next();
+        }
+    }
+
     public synchronized void verify(String hash) throws GigiApiException {
         try (GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `domainPinglog` SET `state`='success' WHERE `challenge`=? AND `state`='open' AND `configId` IN (SELECT `id` FROM `pingconfig` WHERE `domainid`=? AND `type`='email')")) {
             ps.setString(1, hash);