]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/admin/TTPAdminPage.java
add: 403-page, custom 404-message
[gigi.git] / src / org / cacert / gigi / pages / admin / TTPAdminPage.java
index 90c2918cd0a10504b279ed844cd28ae87c7d0f98..cc9a536d8d2970d7330658a0811d7bff617ff125 100644 (file)
@@ -14,6 +14,7 @@ import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.output.Form;
 import org.cacert.gigi.output.template.IterableDataset;
 import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.error.PageNotFound;
 
 public class TTPAdminPage extends Page {
 
@@ -40,10 +41,12 @@ public class TTPAdminPage extends Page {
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
         String path = req.getPathInfo();
-        if (path != null && path.length() > PATH.length()) {
+        if (path != null && path.length() > PATH.length() + 1) {
             int id = Integer.parseInt(path.substring(1 + PATH.length()));
             User u = User.getById(id);
-            if ( !u.isInGroup(TTP_APPLICANT)) {
+            if (u == null || !u.isInGroup(TTP_APPLICANT)) {
+                req.setAttribute(PageNotFound.MESSAGE_ATTRIBUTE, "The TTP-request is not available anymore.");
+                resp.sendError(404);
                 return;
             }
             new TTPAdminForm(req, u).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());