X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Fadmin%2Fsupport%2FSupportUserDetailsPage.java;h=5f626b4ef5d24e3c78a8c7afea46843e664b91f3;hp=5cc35b53a9698c7c581d01c6292bbf973e31e86b;hb=a4a022f3ef3f697298fca60520d422d8662ec706;hpb=b207e1989b166619e924946731e40ccf98457fae diff --git a/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java b/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java index 5cc35b53..5f626b4e 100644 --- a/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java +++ b/src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.cacert.gigi.GigiApiException; +import org.cacert.gigi.dbObjects.Domain; import org.cacert.gigi.dbObjects.EmailAddress; import org.cacert.gigi.dbObjects.SupportedUser; import org.cacert.gigi.dbObjects.User; @@ -22,13 +23,16 @@ public class SupportUserDetailsPage extends Page { public static final String PATH = "/support/user/"; - public SupportUserDetailsPage(String title) { - super(title); + public SupportUserDetailsPage() { + super("Support: User Details"); } @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { int id = -1; + if ( !req.getPathInfo().endsWith("/")) { + resp.sendError(404); + } String[] idP = req.getPathInfo().split("/"); try { id = Integer.parseInt(idP[idP.length - 1]); @@ -48,15 +52,36 @@ public class SupportUserDetailsPage extends Page { @Override public boolean next(Language l, Map vars) { for (; i < addrs.length;) { - String address = addrs[i++].getAddress(); + EmailAddress secAddress = addrs[i++]; + String address = secAddress.getAddress(); if ( !address.equals(user.getEmail())) { vars.put("secmail", address); + vars.put("status", l.getTranslation(secAddress.isVerified() ? "verified" : "not verified")); return true; } } return false; } }); + + final Domain[] doms = user.getDomains(); + vars.put("domains", new IterableDataset() { + + private int point = 0; + + @Override + public boolean next(Language l, Map vars) { + if (point >= doms.length) { + return false; + } + Domain domain = doms[point]; + vars.put("domain", domain.getSuffix()); + vars.put("status", l.getTranslation(domain.isVerified() ? "verified" : "not verified")); + point++; + return true; + } + }); + vars.put("certifrevoke", new SupportRevokeCertificatesForm(req, targetUser)); getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars); }