1 package org.cacert.gigi.pages.main;
3 import java.io.IOException;
4 import java.io.PrintWriter;
5 import java.util.HashMap;
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.http.HttpServletResponse;
9 import javax.servlet.http.HttpSession;
11 import org.cacert.gigi.output.Form;
12 import org.cacert.gigi.pages.Page;
14 public class RegisterPage extends Page {
16 private static final String SIGNUP_PROCESS = "signupProcess";
17 public static final String PATH = "/register";
19 public RegisterPage() {
24 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
25 PrintWriter out = resp.getWriter();
26 HashMap<String, Object> vars = new HashMap<String, Object>();
27 getDefaultTemplate().output(out, getLanguage(req), vars);
28 Signup s = new Signup(req);
29 s.output(out, getLanguage(req), vars);
33 public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
34 Signup s = Form.getForm(req, Signup.class);
36 resp.getWriter().println(translate(req, "CSRF token check failed."));
37 } else if (s.submit(resp.getWriter(), req)) {
38 HttpSession hs = req.getSession();
39 hs.setAttribute(SIGNUP_PROCESS, null);
40 resp.getWriter().println(
41 translate(req, "Your information has been submitted"
42 + " into our system. You will now be sent an email with a web link,"
43 + " you need to open that link in your web browser within 24 hours"
44 + " or your information will be removed from our system!"));
48 super.doPost(req, resp);
52 public boolean needsLogin() {