]> WPIA git - gigi.git/commitdiff
Advance the domain issuing form to prepare for entering ping methods.
authorFelix Dörre <felix@dogcraft.de>
Sun, 24 Aug 2014 00:00:57 +0000 (02:00 +0200)
committerFelix Dörre <felix@dogcraft.de>
Sun, 24 Aug 2014 00:22:02 +0000 (02:22 +0200)
src/org/cacert/gigi/output/template/OutputableArrayIterable.java [new file with mode: 0644]
src/org/cacert/gigi/pages/account/DomainAddForm.java
src/org/cacert/gigi/pages/account/DomainAddForm.templ
static/static/default.css

diff --git a/src/org/cacert/gigi/output/template/OutputableArrayIterable.java b/src/org/cacert/gigi/output/template/OutputableArrayIterable.java
new file mode 100644 (file)
index 0000000..5a78e73
--- /dev/null
@@ -0,0 +1,31 @@
+package org.cacert.gigi.output.template;
+
+import java.util.Map;
+
+import org.cacert.gigi.localisation.Language;
+
+public class OutputableArrayIterable implements IterableDataset {
+
+    Object[] content;
+
+    String targetName;
+
+    int index = 0;
+
+    public OutputableArrayIterable(Object[] content, String targetName) {
+        this.content = content;
+        this.targetName = targetName;
+    }
+
+    @Override
+    public boolean next(Language l, Map<String, Object> vars) {
+        if (index >= content.length) {
+            return false;
+        }
+        vars.put(targetName, content[index]);
+        vars.put("i", index);
+        index++;
+        return true;
+    }
+
+}
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);
     }
-
 }
index 7cc480d564aa0fe31605c09071d2f7ee3ec806c6..8273efe25e3c35a0df100b3886a2bf18fc5bc7e9 100644 (file)
@@ -6,9 +6,74 @@
   </thead>
 <tbody>
   <tr>
-    <td width="125"><?=_Domain?> </td>
-    <td width="125"><input type="text" name="newdomain" value=""></td>
+    <td><?=_Domain?> </td>
+    <td><input type="text" name="newdomain" value=""> (<?=_In the following:?> <span class='exampleDomainPlace'>example.org</span>)</td>
   </tr>
+  <tr><th></th><th><?=_Verification mechanisms?></th></tr>
+
+  <tr>
+    <td><input type="checkbox" name="emailType" value="y"></td>
+    <td><?=_Verify by sending an email to autorative email addresses?> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td class='radio'>
+        Select the destination mail address:<br/>
+        <? foreach($authEmails) { ?>
+        <input type="radio" id="email_<?=$i?>" name="email" value="<?=$i?>"/>
+        <label for="email_1"><div class='name'><?=$email?>@<span class='exampleDomain'>example.org</span></div></label><div class='elements'></div>
+        <? } ?>
+       </td>
+  </tr>
+
+  <tr>
+    <td><input type="checkbox" name="DNSType" value="y"></td>
+    <td><?=_Verify by reading DNS-TXT entries?> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td>
+        Please insert the following DNS TXT entry into the SOA-file of your domain:<br/>
+        <pre>
+        cacert-<?=$tokenName?> IN      TXT     "<?=$tokenValue?>"
+        </pre>
+    </td>
+  </tr>
+
+  <tr>
+    <td><input type="checkbox" name="HTTPType" value="y"></td>
+    <td><?=_Verify by reading HTTP-content?> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td>
+        Please make the following content available under <pre class='string'>http://<span class='exampleDomain'>example.org</span>/cacert-<?=$tokenName?>.txt</pre><br/>
+        <pre><?=$tokenValue?></pre>
+    </td>
+  </tr>
+
+  <tr>
+    <td><input type="checkbox" name="SSLType" value="y"></td>
+    <td><?=_Verify by searching for installed certificate.?> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td>
+        Please list up to three services using your certificate:
+        <table>
+        <? foreach($ssl-services){ ?>
+        <tr><td><select name='ssl-type-<?=$i?>'>
+          <option>direct</option>
+          <option>xmpp</option>
+          <option>server-xmpp</option>
+          <option>smtp</option>
+          <option>imap</option></select>
+        </td><td>Port: <input type='text' name='ssl-port-<?=$i?>'></td></tr>
+        <? } ?>
+        </table>
+    </td>
+  </tr>
+
   <tr>
     <td colspan="2"><input type="submit" name="adddomain" value="<?=_I own or am authorised to control this domain?>"></td>
   </tr>
index bb25762da1ee8acdd4f98b6bbcd3eaa7ce411ecc..74344bc86cc0ebe5bf9433e1b2c9e63efce797bf 100644 (file)
@@ -784,3 +784,7 @@ pre{
 .dataTable textarea{
        width: 100%;
 }
+
+pre.string{
+       display: inline;
+}
\ No newline at end of file