X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Fmain%2FRegisterPage.java;h=b38194994bb69044907a3f3910feaae618482311;hb=d463b3c42abe2f8edda3951580cf339dca6bb58e;hp=502f979d5983ae642657a4711e7e65d95397e714;hpb=4fc466a7d4d7bf71f2cdb62e11eeccfbffdbb274;p=gigi.git diff --git a/src/org/cacert/gigi/pages/main/RegisterPage.java b/src/org/cacert/gigi/pages/main/RegisterPage.java index 502f979d..b3819499 100644 --- a/src/org/cacert/gigi/pages/main/RegisterPage.java +++ b/src/org/cacert/gigi/pages/main/RegisterPage.java @@ -1,48 +1,39 @@ package org.cacert.gigi.pages.main; import java.io.IOException; -import java.io.InputStreamReader; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.cacert.gigi.output.Template; import org.cacert.gigi.pages.Page; public class RegisterPage extends Page { + private static final String SIGNUP_PROCESS = "signupProcess"; public static final String PATH = "/register"; - Template t; public RegisterPage() { super("Register"); - try { - t = new Template(new InputStreamReader( - Signup.class.getResourceAsStream("RegisterPage.templ"), - "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } } @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PrintWriter out = resp.getWriter(); - t.output(out, getLanguage(req), new HashMap()); + HashMap vars = new HashMap(); + getDefaultTemplate().output(out, getLanguage(req), vars); Signup s = getForm(req); - s.writeForm(out, getLanguage(req)); + s.output(out, getLanguage(req), vars); } public Signup getForm(HttpServletRequest req) { HttpSession hs = req.getSession(); - Signup s = (Signup) hs.getAttribute("signupProcess"); + Signup s = (Signup) hs.getAttribute(SIGNUP_PROCESS); if (s == null) { s = new Signup(); - hs.setAttribute("signupProcess", s); + hs.setAttribute(SIGNUP_PROCESS, s); } return s; @@ -51,7 +42,19 @@ public class RegisterPage extends Page { public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { Signup s = getForm(req); - s.submit(resp.getWriter(), req); + if (s.submit(resp.getWriter(), req)) { + HttpSession hs = req.getSession(); + hs.setAttribute(SIGNUP_PROCESS, null); + resp.getWriter() + .println( + translate( + req, + "Your information has been submitted" + + " into our system. You will now be sent an email with a web link," + + " you need to open that link in your web browser within 24 hours" + + " or your information will be removed from our system!")); + return; + } super.doPost(req, resp); }