1 package org.cacert.gigi.pages.main;
3 import java.io.IOException;
4 import java.io.InputStreamReader;
5 import java.io.PrintWriter;
6 import java.io.UnsupportedEncodingException;
7 import java.util.HashMap;
9 import javax.servlet.http.HttpServletRequest;
10 import javax.servlet.http.HttpServletResponse;
11 import javax.servlet.http.HttpSession;
13 import org.cacert.gigi.output.Template;
14 import org.cacert.gigi.pages.Page;
16 public class RegisterPage extends Page {
18 private static final String SIGNUP_PROCESS = "signupProcess";
19 public static final String PATH = "/register";
22 public RegisterPage() {
25 t = new Template(new InputStreamReader(
26 Signup.class.getResourceAsStream("RegisterPage.templ"),
28 } catch (UnsupportedEncodingException e) {
34 public void doGet(HttpServletRequest req, HttpServletResponse resp)
36 PrintWriter out = resp.getWriter();
37 t.output(out, getLanguage(req), new HashMap<String, Object>());
38 Signup s = getForm(req);
39 s.writeForm(out, getLanguage(req));
41 public Signup getForm(HttpServletRequest req) {
42 HttpSession hs = req.getSession();
43 Signup s = (Signup) hs.getAttribute(SIGNUP_PROCESS);
46 hs.setAttribute(SIGNUP_PROCESS, s);
52 public void doPost(HttpServletRequest req, HttpServletResponse resp)
54 Signup s = getForm(req);
55 if (s.submit(resp.getWriter(), req)) {
56 HttpSession hs = req.getSession();
57 hs.setAttribute(SIGNUP_PROCESS, null);
62 "Your information has been submitted"
63 + " into our system. You will now be sent an email with a web link,"
64 + " you need to open that link in your web browser within 24 hours"
65 + " or your information will be removed from our system!"));
69 super.doPost(req, resp);
72 public boolean needsLogin() {