]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/wot/AssuranceForm.java
Enforce Output of CSRF token.
[gigi.git] / src / org / cacert / gigi / pages / wot / AssuranceForm.java
index 056a28ab6963714cc5ce0ee5a2222ea10e31991f..5819eb4d8b508a40e3c27b7aca9186cecc4df705 100644 (file)
@@ -32,10 +32,16 @@ public class AssuranceForm extends Form {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 
        @Override
-       public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+       public void outputContent(PrintWriter out, Language l,
+                       Map<String, Object> vars) {
                HashMap<String, Object> res = new HashMap<String, Object>();
                res.putAll(vars);
                res.put("name", assuree.getName());
+               try {
+                       res.put("maxpoints", assuree.getMaxAssurePoints());
+               } catch (SQLException e) {
+                       e.printStackTrace();
+               }
                res.put("dob", sdf.format(assuree.getDob()));
                templ.output(out, l, res);
        }
@@ -90,19 +96,25 @@ public class AssuranceForm extends Form {
                        // TODO message
                        failed = true;
                }
-               out.println("</div>");
                if (failed) {
+                       out.println("</div>");
                        return false;
                }
                try {
                        boolean success = Notary.assure(LoginPage.getUser(req), assuree,
                                        Integer.parseInt(req.getParameter("points")),
                                        req.getParameter("location"), req.getParameter("date"));
+                       if (!success) {
+                               outputError(out, req,
+                                               "Assurance failed. Maybe user data changed.");
+                       }
+                       out.println("</div>");
                        return success;
                } catch (SQLException e) {
                        e.printStackTrace();
                }
 
+               out.println("</div>");
                return false;
        }
 }