X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2FMyDetailsForm.java;h=9ea66b359965f8ba0142b1ca4cbcced21f252335;hb=6b7d6a59d006d1d252ccbe86a4f5ab7099c6c002;hp=8f7c7bf82301cbf6257fcb31e9a684ddebd2450d;hpb=6dcec2ace981aadba1f0a04e20e2bafe19b47976;p=gigi.git diff --git a/src/org/cacert/gigi/pages/account/MyDetailsForm.java b/src/org/cacert/gigi/pages/account/MyDetailsForm.java index 8f7c7bf8..9ea66b35 100644 --- a/src/org/cacert/gigi/pages/account/MyDetailsForm.java +++ b/src/org/cacert/gigi/pages/account/MyDetailsForm.java @@ -37,20 +37,23 @@ public class MyDetailsForm extends Form { @Override public boolean submit(PrintWriter out, HttpServletRequest req) { try { - if (target.getAssurancePoints() == 0) { - String newFname = req.getParameter("fname").trim(); - String newLname = req.getParameter("lname").trim(); - String newMname = req.getParameter("mname").trim(); - String newSuffix = req.getParameter("suffix").trim(); - if (newLname.isEmpty()) { - throw new GigiApiException("Last name cannot be empty."); + synchronized (target) { + if (target.getAssurancePoints() == 0) { + String newFname = req.getParameter("fname").trim(); + String newLname = req.getParameter("lname").trim(); + String newMname = req.getParameter("mname").trim(); + String newSuffix = req.getParameter("suffix").trim(); + if (newLname.isEmpty()) { + throw new GigiApiException("Last name cannot be empty."); + } + + target.setName(new Name(newFname, newLname, newMname, newSuffix)); + ds.update(req); + target.setDoB(ds.getDate()); + target.updateUserData(); + } else { + throw new GigiApiException("No change after assurance allowed."); } - target.setName(new Name(newFname, newLname, newMname, newSuffix)); - ds.update(req); - target.setDoB(ds.getDate()); - target.updateUserData(); - } else { - throw new GigiApiException("No change after assurance allowed."); } } catch (GigiApiException e) { e.format(out, Page.getLanguage(req)); @@ -74,7 +77,7 @@ public class MyDetailsForm extends Form { vars.put("DoB", ds); templ.output(out, l, vars); } else { - vars.put("DoB", DateSelector.getDateFormat().format(target.getDoB())); + vars.put("DoB", target.getDoB()); assured.output(out, l, vars); } }