X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2FdbObjects%2FEmailAddress.java;h=f8629d946bc85bc396947d2c360a2314704babde;hp=319e415b93e86a97d89da13ddcf5b18e8df12ec8;hb=675483fd43f4b6770895babeb043409bc65caa56;hpb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e diff --git a/src/club/wpia/gigi/dbObjects/EmailAddress.java b/src/club/wpia/gigi/dbObjects/EmailAddress.java index 319e415b..f8629d94 100644 --- a/src/club/wpia/gigi/dbObjects/EmailAddress.java +++ b/src/club/wpia/gigi/dbObjects/EmailAddress.java @@ -13,6 +13,7 @@ import club.wpia.gigi.email.MailProbe; import club.wpia.gigi.localisation.Language; import club.wpia.gigi.output.template.SprintfCommand; import club.wpia.gigi.util.RandomToken; +import club.wpia.gigi.util.TimeConditions; public class EmailAddress implements IdCachable, Verifyable { @@ -110,7 +111,7 @@ public class EmailAddress implements IdCachable, Verifyable { stmt.setInt(2, owner.getId()); stmt.setString(3, hash); if ( !stmt.executeMaybeUpdate()) { - throw new IllegalArgumentException("Given token could not be found to complete the verification process (Domain Ping)."); + throw new IllegalArgumentException("Given token could not be found to complete the verification process (Email Ping)."); } } // Verify user with that primary email @@ -122,9 +123,10 @@ public class EmailAddress implements IdCachable, Verifyable { } public boolean isVerified() { - try (GigiPreparedStatement statmt = new GigiPreparedStatement("SELECT 1 FROM `emailPinglog` WHERE `email`=? AND `uid`=? AND `type`='active' AND `status`='success'")) { + try (GigiPreparedStatement statmt = new GigiPreparedStatement("SELECT 1 FROM `emailPinglog` WHERE `email`=? AND `uid`=? AND `type`='active' AND `status`='success' AND `when` > (now() - interval '1 months' * ?::INTEGER)")) { statmt.setString(1, address); statmt.setInt(2, owner.getId()); + statmt.setInt(3, TimeConditions.getInstance().getEmailPingMonths()); GigiResultSet e = statmt.executeQuery(); return e.next(); }