1 package org.cacert.gigi.pages.wot;
3 import java.io.IOException;
4 import java.util.HashMap;
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
9 import org.cacert.gigi.GigiApiException;
10 import org.cacert.gigi.dbObjects.Assurance;
11 import org.cacert.gigi.dbObjects.User;
12 import org.cacert.gigi.output.template.Form;
13 import org.cacert.gigi.pages.LoginPage;
14 import org.cacert.gigi.pages.Page;
16 public class RequestTTPPage extends Page {
18 public static final String PATH = "/wot/ttp";
20 public RequestTTPPage() {
25 public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
27 Form.getForm(req, RequestTTPForm.class).submit(resp.getWriter(), req);
28 } catch (GigiApiException e) {
29 e.format(resp.getWriter(), getLanguage(req));
34 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
35 User u = LoginPage.getUser(req);
36 HashMap<String, Object> map = new HashMap<String, Object>();
37 if (u.isInGroup(RequestTTPForm.TTP_APPLICANT)) {
38 map.put("inProgress", true);
40 if (u.getAssurancePoints() < 100) {
42 for (Assurance a : u.getReceivedAssurances()) {
43 if (a.getMethod().equals(Assurance.AssuranceType.TTP_ASSISTED.getDescription())) {
49 map.put("form", new RequestTTPForm(req));
51 map.put("nothing", true);
54 map.put("nothing", true);
57 map.put("form", new RequestTTPForm(req));
58 getDefaultTemplate().output(resp.getWriter(), getLanguage(req), map);