]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/admin/support/SupportUserDetailsPage.java
add: show verification status of email address for support
[gigi.git] / src / org / cacert / gigi / pages / admin / support / SupportUserDetailsPage.java
index b0ddb8fee7cdce3cd9ef81590988e1a0ccae555c..fad39e90c4007cc2b69b7f2eb90e0d78280d325f 100644 (file)
@@ -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,8 +23,8 @@ 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
@@ -47,17 +48,37 @@ public class SupportUserDetailsPage extends Page {
 
             @Override
             public boolean next(Language l, Map<String, Object> vars) {
-                if (i == addrs.length) {
-                    return false;
+                for (; i < addrs.length;) {
+                    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;
+                    }
                 }
-                String address = addrs[i].getAddress();
-                i++;
-                if ( !address.equals(user.getEmail())) {
-                    vars.put("secmail", address);
+                return false;
+            }
+        });
+
+        final Domain[] doms = user.getDomains();
+        vars.put("domains", new IterableDataset() {
+
+            private int point = 0;
+
+            @Override
+            public boolean next(Language l, Map<String, Object> 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);
     }
@@ -69,7 +90,7 @@ public class SupportUserDetailsPage extends Page {
                 if ( !Form.getForm(req, SupportRevokeCertificatesForm.class).submit(resp.getWriter(), req)) {
                     throw new GigiApiException("No ticket number set.");
                 }
-            } else if (req.getParameter("detailupdate") != null) {
+            } else if (req.getParameter("detailupdate") != null || req.getParameter("resetPass") != null || req.getParameter("deny") != null || req.getParameter("grant") != null) {
                 if ( !Form.getForm(req, SupportUserDetailsForm.class).submit(resp.getWriter(), req)) {
                     throw new GigiApiException("No ticket number set.");
                 }