From 396c265f50238b7dfb5e3cb1e80e9cc38721055d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Sun, 24 Aug 2014 02:00:57 +0200 Subject: [PATCH] Advance the domain issuing form to prepare for entering ping methods. --- .../template/OutputableArrayIterable.java | 31 +++++++++ .../gigi/pages/account/DomainAddForm.java | 29 +++++++- .../gigi/pages/account/DomainAddForm.templ | 69 ++++++++++++++++++- static/static/default.css | 4 ++ 4 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 src/org/cacert/gigi/output/template/OutputableArrayIterable.java diff --git a/src/org/cacert/gigi/output/template/OutputableArrayIterable.java b/src/org/cacert/gigi/output/template/OutputableArrayIterable.java new file mode 100644 index 00000000..5a78e73b --- /dev/null +++ b/src/org/cacert/gigi/output/template/OutputableArrayIterable.java @@ -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 vars) { + if (index >= content.length) { + return false; + } + vars.put(targetName, content[index]); + vars.put("i", index); + index++; + return true; + } + +} diff --git a/src/org/cacert/gigi/pages/account/DomainAddForm.java b/src/org/cacert/gigi/pages/account/DomainAddForm.java index 55fcbbec..809425e4 100644 --- a/src/org/cacert/gigi/pages/account/DomainAddForm.java +++ b/src/org/cacert/gigi/pages/account/DomainAddForm.java @@ -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 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 vars) { + if (counter >= 4) { + return false; + } + vars.put("i", counter); + counter++; + return true; + } + }); t.output(out, l, vars); } - } diff --git a/src/org/cacert/gigi/pages/account/DomainAddForm.templ b/src/org/cacert/gigi/pages/account/DomainAddForm.templ index 7cc480d5..8273efe2 100644 --- a/src/org/cacert/gigi/pages/account/DomainAddForm.templ +++ b/src/org/cacert/gigi/pages/account/DomainAddForm.templ @@ -6,9 +6,74 @@ - - + + ( example.org) + + + + + + + + + + Select the destination mail address:
+ + +
+ + + + + + + + + + + + Please insert the following DNS TXT entry into the SOA-file of your domain:
+
+        cacert-	IN	TXT	""
+        
+ + + + + + + + + + + Please make the following content available under
http://example.org/cacert-.txt

+
+ + + + + + + + + + + Please list up to three services using your certificate: + + + + +
+ Port:
+ + + diff --git a/static/static/default.css b/static/static/default.css index bb25762d..74344bc8 100644 --- a/static/static/default.css +++ b/static/static/default.css @@ -784,3 +784,7 @@ pre{ .dataTable textarea{ width: 100%; } + +pre.string{ + display: inline; +} \ No newline at end of file -- 2.39.2