X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=util-testing%2Fclub%2Fwpia%2Fgigi%2Fpages%2FManager.java;h=bed50973a1bbef8d13c791cb514bd409f05080b4;hp=f68d307bcb8a14789722c11d07d10a9ef7e07541;hb=c33cfdbb921ffee8dae0e1fdede9c7bff55e00f4;hpb=770aa3cabf55da5c3e955764dc6ea7159130821d diff --git a/util-testing/club/wpia/gigi/pages/Manager.java b/util-testing/club/wpia/gigi/pages/Manager.java index f68d307b..bed50973 100644 --- a/util-testing/club/wpia/gigi/pages/Manager.java +++ b/util-testing/club/wpia/gigi/pages/Manager.java @@ -48,6 +48,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; @@ -166,7 +167,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; } } @@ -447,6 +450,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 byEmail = User.getByEmail(mail); @@ -628,4 +642,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(); + } }