X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Fadmin%2FTTPAdminPage.java;h=286a08d5639b377fb650d301c27153985a1a9d93;hp=a6bd0d47308a1d0972b52357e5e7a9dbc9e070f4;hb=abff88a2bf173198fe55c35ead97c9c7cdb5924c;hpb=4d9b0e8bdf122324cec9f3dd387c02d14c30877e diff --git a/src/org/cacert/gigi/pages/admin/TTPAdminPage.java b/src/org/cacert/gigi/pages/admin/TTPAdminPage.java index a6bd0d47..286a08d5 100644 --- a/src/org/cacert/gigi/pages/admin/TTPAdminPage.java +++ b/src/org/cacert/gigi/pages/admin/TTPAdminPage.java @@ -8,7 +8,6 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.cacert.gigi.GigiApiException; import org.cacert.gigi.dbObjects.Group; import org.cacert.gigi.dbObjects.User; import org.cacert.gigi.localisation.Language; @@ -23,20 +22,22 @@ public class TTPAdminPage extends Page { public static final String PATH = "/admin/ttp"; - public static final Group TTP_APPLICANT = Group.getByString("ttp-applicant"); + public static final Group TTP_APPLICANT = Group.TTP_APPLICANT; public TTPAdminPage() { super("TTP-Admin"); } + @Override + public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException { + return Form.getForm(req, TTPAdminForm.class).submitExceptionProtected(req, resp); + } + @Override public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { - try { - Form.getForm(req, TTPAdminForm.class).submit(resp.getWriter(), req); - } catch (GigiApiException e) { - e.format(resp.getWriter(), getLanguage(req)); + if (Form.printFormErrors(req, resp.getWriter())) { + Form.getForm(req, TTPAdminForm.class).output(resp.getWriter(), getLanguage(req), new HashMap()); } - resp.sendRedirect(PATH); } private static final int PAGE_LEN = 30; @@ -74,7 +75,7 @@ public class TTPAdminPage extends Page { return false; } vars.put("id", Integer.toString(users[i].getId())); - vars.put("name", users[i].getName().toString()); + vars.put("name", users[i].getPreferredName().toString()); vars.put("email", users[i].getEmail()); i++; @@ -89,6 +90,6 @@ public class TTPAdminPage extends Page { @Override public boolean isPermitted(AuthorizationContext ac) { - return ac != null && ac.isInGroup(Group.getByString("ttp-assurer")); + return ac != null && ac.isInGroup(Group.TTP_ASSURER); } }