]> WPIA git - gigi.git/commitdiff
fix: circumvent several exceptions
authorFelix Dörre <felix@dogcraft.de>
Thu, 19 Nov 2015 10:52:01 +0000 (11:52 +0100)
committerFelix Dörre <felix@dogcraft.de>
Thu, 19 Nov 2015 10:52:01 +0000 (11:52 +0100)
src/org/cacert/gigi/pages/PasswordResetPage.java

index 8faaf8263ecc5a4c066d8aa0ec6738d5efdd6cd7..c25fe5c1b7fed60bba5087738fe469a0de780c6c 100644 (file)
@@ -33,8 +33,17 @@ public class PasswordResetPage extends Page {
 
         public PasswordResetForm(HttpServletRequest hsr) throws GigiApiException {
             super(hsr, PATH);
-            id = Integer.parseInt(hsr.getParameter("id"));
-            u = User.getResetWithToken(id, hsr.getParameter("token"));
+            String idS = hsr.getParameter("id");
+            String tokS = hsr.getParameter("token");
+            if (idS == null || tokS == null) {
+                throw new GigiApiException("requires id and token");
+            }
+            try {
+                id = Integer.parseInt(idS);
+            } catch (NumberFormatException e) {
+                throw new GigiApiException("requires id to be integer");
+            }
+            u = User.getResetWithToken(id, tokS);
             if (u == null) {
                 throw new GigiApiException("User missing or token invalid");
             }