]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/account/DomainAddForm.java
Advance the domain issuing form to prepare for entering ping methods.
[gigi.git] / src / org / cacert / gigi / pages / account / DomainAddForm.java
index 55fcbbecbe3fd062b33962ef5951b52e66500b35..809425e4048f4e73aeca58df13c8fb4abdc99acf 100644 (file)
@@ -10,8 +10,11 @@ import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.User;
 import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.output.Form;
+import org.cacert.gigi.output.template.IterableDataset;
+import org.cacert.gigi.output.template.OutputableArrayIterable;
 import org.cacert.gigi.output.template.Template;
 import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.util.RandomToken;
 
 public class DomainAddForm extends Form {
 
@@ -19,6 +22,10 @@ public class DomainAddForm extends Form {
 
     private User target;
 
+    private String tokenName = RandomToken.generateToken(8);
+
+    private String tokenValue = RandomToken.generateToken(16);
+
     public DomainAddForm(HttpServletRequest hsr, User target) {
         super(hsr);
         this.target = target;
@@ -40,9 +47,29 @@ public class DomainAddForm extends Form {
         }
     }
 
+    public static final String[] AUTHORATIVE_EMAILS = new String[] {
+            "root", "hostmaster", "postmaster", "admin", "webmaster"
+    };
+
     @Override
     protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
+        vars.put("tokenName", tokenName);
+        vars.put("tokenValue", tokenValue);
+        vars.put("authEmails", new OutputableArrayIterable(AUTHORATIVE_EMAILS, "email"));
+        vars.put("ssl-services", new IterableDataset() {
+
+            int counter = 0;
+
+            @Override
+            public boolean next(Language l, Map<String, Object> vars) {
+                if (counter >= 4) {
+                    return false;
+                }
+                vars.put("i", counter);
+                counter++;
+                return true;
+            }
+        });
         t.output(out, l, vars);
     }
-
 }