X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=util-testing%2Fclub%2Fwpia%2Fgigi%2Fpages%2FManager.java;h=7dabe4f2720e1836dfa5e383df61a433ae80310f;hp=2f866b2d22db8a3dc2ae3cbeb53211852467f095;hb=3889444cb95132e342e4b7156245dd032ed3b16b;hpb=4bae004675e4814f0aee765f840e524a37d9c846 diff --git a/util-testing/club/wpia/gigi/pages/Manager.java b/util-testing/club/wpia/gigi/pages/Manager.java index 2f866b2d..7dabe4f2 100644 --- a/util-testing/club/wpia/gigi/pages/Manager.java +++ b/util-testing/club/wpia/gigi/pages/Manager.java @@ -47,6 +47,7 @@ import club.wpia.gigi.dbObjects.DomainPingExecution; import club.wpia.gigi.dbObjects.DomainPingType; import club.wpia.gigi.dbObjects.EmailAddress; import club.wpia.gigi.dbObjects.Group; +import club.wpia.gigi.dbObjects.Name; import club.wpia.gigi.dbObjects.NamePart; import club.wpia.gigi.dbObjects.NamePart.NamePartType; import club.wpia.gigi.dbObjects.User; @@ -165,7 +166,9 @@ public class Manager extends Page { ps.setString(6, getRandomCountry().getCode()); ps.execute(); } - new Contract(u, ContractType.RA_AGENT_CONTRACT); + if ( !Contract.hasSignedContract(u, ContractType.RA_AGENT_CONTRACT)) { + new Contract(u, ContractType.RA_AGENT_CONTRACT); + } return u; } } @@ -451,6 +454,17 @@ public class Manager extends Page { resp.getWriter().println("User has been verified " + verifications + " times." + info); + } else if (req.getParameter("verifyexpire") != null) { + String mail = req.getParameter("verifyEmail"); + User byEmail = User.getByEmail(mail); + if (byEmail == null) { + resp.getWriter().println("User not found."); + return; + } else { + setVerificationDateToPast(byEmail.getPreferredName()); + } + + resp.getWriter().println("Verification set to time past the limit."); } else if (req.getParameter("letverify") != null) { String mail = req.getParameter("letverifyEmail"); User userByEmail = User.getByEmail(mail); @@ -632,4 +646,18 @@ public class Manager extends Page { form.output(resp.getWriter(), getLanguage(req), vars); } + + private static void setVerificationDateToPast(Name name) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(System.currentTimeMillis()); + c.add(Calendar.MONTH, -TimeConditions.getInstance().getVerificationMonths()); + String date = sdf.format(new Date(c.getTimeInMillis())); + GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `notary` SET `date`=? WHERE `to`=? AND `date`>?"); + ps.setString(1, date); + ps.setInt(2, name.getId()); + ps.setString(3, date); + ps.execute(); + ps.close(); + } }