From 457c7c1aeadfb4145572ec1155603ae4bebfedd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Sat, 21 Jun 2014 22:01:01 +0200 Subject: [PATCH] Add register page with dummy language "de" --- src/org/cacert/gigi/Gigi.java | 2 + src/org/cacert/gigi/Language.java | 7 ++- src/org/cacert/gigi/pages/Page.java | 7 +++ .../cacert/gigi/pages/main/RegisterPage.java | 57 +++++++++++++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 src/org/cacert/gigi/pages/main/RegisterPage.java diff --git a/src/org/cacert/gigi/Gigi.java b/src/org/cacert/gigi/Gigi.java index c52b98f0..8fbdbc22 100644 --- a/src/org/cacert/gigi/Gigi.java +++ b/src/org/cacert/gigi/Gigi.java @@ -22,6 +22,7 @@ import org.cacert.gigi.database.DatabaseConnection; import org.cacert.gigi.pages.LoginPage; import org.cacert.gigi.pages.MainPage; import org.cacert.gigi.pages.Page; +import org.cacert.gigi.pages.main.RegisterPage; import org.cacert.gigi.util.PasswordHash; import org.eclipse.jetty.util.log.Log; @@ -36,6 +37,7 @@ public class Gigi extends HttpServlet { public void init() throws ServletException { pages.put("/login", new LoginPage("CACert - Login")); pages.put("/", new MainPage("CACert - Home")); + pages.put(RegisterPage.PATH, new RegisterPage()); String templ = ""; try { BufferedReader reader = new BufferedReader(new InputStreamReader( diff --git a/src/org/cacert/gigi/Language.java b/src/org/cacert/gigi/Language.java index 431f0b32..9faaaad6 100644 --- a/src/org/cacert/gigi/Language.java +++ b/src/org/cacert/gigi/Language.java @@ -35,6 +35,9 @@ public class Language { } System.out.println(translations.size() + " strings loaded."); } + public String getTranslation(String text) { + return translations.get(text); + } public static Language getInstance(String language) { Language l = langs.get(language); if (l == null) { @@ -51,7 +54,5 @@ public class Language { } return l; } - public static void main(String[] args) { - Language.getInstance("de"); - } + } diff --git a/src/org/cacert/gigi/pages/Page.java b/src/org/cacert/gigi/pages/Page.java index afe96dc7..7b69e56c 100644 --- a/src/org/cacert/gigi/pages/Page.java +++ b/src/org/cacert/gigi/pages/Page.java @@ -5,6 +5,8 @@ import java.io.IOException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; +import org.cacert.gigi.Language; + public abstract class Page { private String title; @@ -27,4 +29,9 @@ public abstract class Page { public void setTitle(String title) { this.title = title; } + public static String translate(ServletRequest req, String string) { + Language l = Language.getInstance("de"); + return l.getTranslation(string); + } + } diff --git a/src/org/cacert/gigi/pages/main/RegisterPage.java b/src/org/cacert/gigi/pages/main/RegisterPage.java new file mode 100644 index 00000000..f162b913 --- /dev/null +++ b/src/org/cacert/gigi/pages/main/RegisterPage.java @@ -0,0 +1,57 @@ +package org.cacert.gigi.pages.main; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.cacert.gigi.pages.Page; + +public class RegisterPage extends Page { + + public static final String PATH = "/register"; + + public RegisterPage() { + super("Register"); + } + + @Override + public void doGet(ServletRequest req, ServletResponse resp) + throws IOException { + PrintWriter out = resp.getWriter(); + out.print("

"); + out.print(translate( + req, + "By joining CAcert and becoming a member, you agree to the CAcert Community Agreement. Please take a moment now to read that and agree to it; this will be required to complete the process of joining.")); + out.println("

"); + out.print("

"); + out.print(translate( + req, + "Warning! This site requires cookies to be enabled to ensure your privacy and security. This site uses session cookies to store temporary values to prevent people from copying and pasting the session ID to someone else exposing their account, personal details and identity theft as a result.")); + out.println("

"); + out.print("

"); + out.print(translate( + req, + "Note: Please enter your date of birth and names as they are written in your official documents.")); + out.println("

"); + out.println(translate( + req, + "Because CAcert is a certificate authority (CA) people rely on us knowing about the identity of the users of our certificates. So even as we value privacy very much, we need to collect at least some basic information about our members. This is especially the case for everybody who wants to take part in our web of trust.")); + out.print(translate( + req, + "Your private information will be used for internal procedures only and will not be shared with third parties.")); + out.println("

"); + out.print("

"); + out.println(translate( + req, + "A proper password wouldn't match your name or email at all, it contains at least 1 lower case letter, 1 upper case letter, a number, white space and a misc symbol. You get additional security for being over 15 characters and a second additional point for having it over 30. The system starts reducing security if you include any section of your name, or password or email address or if it matches a word from the english dictionary...")); + out.println("

"); + out.print(""); + out.print(translate(req, + "Note: White spaces at the beginning and end of a password will be removed.")); + out.println(""); + out.println("

"); + + } +} -- 2.39.2