1 package org.cacert.gigi.pages;
3 import java.io.IOException;
4 import java.io.PrintWriter;
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
9 import org.cacert.gigi.GigiApiException;
10 import org.cacert.gigi.dbObjects.Domain;
11 import org.cacert.gigi.dbObjects.EmailAddress;
13 public class Verify extends Page {
15 public static final String PATH = "/verify";
18 super("Verify email");
22 public boolean needsLogin() {
27 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
28 PrintWriter out = resp.getWriter();
29 String hash = req.getParameter("hash");
30 String type = req.getParameter("type");
31 String id = req.getParameter("id");
32 if ("email".equals(type)) {
34 EmailAddress ea = EmailAddress.getById(Integer.parseInt(id));
36 out.println("Email verification completed.");
37 } catch (IllegalArgumentException e) {
38 out.println(translate(req, "The email address is invalid."));
39 } catch (GigiApiException e) {
40 e.format(out, getLanguage(req));
42 } else if ("domain".equals(type)) {
44 Domain ea = Domain.getById(Integer.parseInt(id));
46 out.println("Domain verification completed.");
47 } catch (IllegalArgumentException e) {
48 out.println(translate(req, "The domain address is invalid."));
49 } catch (GigiApiException e) {
50 e.format(out, getLanguage(req));