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.pages.Page;
13 public class RegisterPage extends Page {
15 private static final String SIGNUP_PROCESS = "signupProcess";
16 public static final String PATH = "/register";
18 public RegisterPage() {
23 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
24 PrintWriter out = resp.getWriter();
25 HashMap<String, Object> vars = new HashMap<String, Object>();
26 getDefaultTemplate().output(out, getLanguage(req), vars);
27 Signup s = getForm(req);
28 s.output(out, getLanguage(req), vars);
31 public Signup getForm(HttpServletRequest req) {
32 HttpSession hs = req.getSession();
33 Signup s = (Signup) hs.getAttribute(SIGNUP_PROCESS);
36 hs.setAttribute(SIGNUP_PROCESS, s);
43 public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
44 Signup s = getForm(req);
45 if (s.submit(resp.getWriter(), req)) {
46 HttpSession hs = req.getSession();
47 hs.setAttribute(SIGNUP_PROCESS, null);
48 resp.getWriter().println(
49 translate(req, "Your information has been submitted"
50 + " into our system. You will now be sent an email with a web link,"
51 + " you need to open that link in your web browser within 24 hours"
52 + " or your information will be removed from our system!"));
56 super.doPost(req, resp);
60 public boolean needsLogin() {