1 package org.cacert.gigi.pages;
3 import java.io.IOException;
4 import java.io.PrintWriter;
5 import javax.servlet.http.HttpServletRequest;
6 import javax.servlet.http.HttpServletResponse;
8 import org.cacert.gigi.EmailAddress;
9 import org.cacert.gigi.GigiApiException;
11 public class Verify extends Page {
12 public static final String PATH = "/verify";
15 super("Verify email");
19 public boolean needsLogin() {
24 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
25 PrintWriter out = resp.getWriter();
26 String hash = req.getParameter("hash");
27 String type = req.getParameter("type");
28 String id = req.getParameter("id");
29 if ("email".equals(type)) {
31 EmailAddress ea = EmailAddress.getById(Integer.parseInt(id));
33 out.println("Email verification completed.");
34 } catch (IllegalArgumentException e) {
35 out.println(translate(req, "The email address is invalid."));
36 } catch (GigiApiException e) {
37 e.format(out, getLanguage(req));