X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Fwot%2FAssuranceForm.java;h=e5521dab20b3ca251798811995d5c048502bad74;hb=c4d3f24d14399e48026850fd69b15bd108c020e4;hp=7d15e8dac5386d25b7179df81805c97ad8a5e1c2;hpb=9def69bd08ea69eb27786d5b34f00e154e09e9f3;p=gigi.git diff --git a/src/org/cacert/gigi/pages/wot/AssuranceForm.java b/src/org/cacert/gigi/pages/wot/AssuranceForm.java index 7d15e8da..e5521dab 100644 --- a/src/org/cacert/gigi/pages/wot/AssuranceForm.java +++ b/src/org/cacert/gigi/pages/wot/AssuranceForm.java @@ -152,14 +152,14 @@ public class AssuranceForm extends Form { try { type = AssuranceType.valueOf(val); } catch (IllegalArgumentException e) { - gae.mergeInto(new GigiApiException("Assurance Type wrong.")); + gae.mergeInto(new GigiApiException("Verification Type wrong.")); } } int pointsI = 0; String points = req.getParameter("points"); if (points == null || "".equals(points)) { - gae.mergeInto(new GigiApiException("For an assurance, you need to enter points.")); + gae.mergeInto(new GigiApiException("For a verification, you need to enter points.")); } else { try { pointsI = Integer.parseInt(points); @@ -167,7 +167,8 @@ public class AssuranceForm extends Form { gae.mergeInto(new GigiApiException("The points entered were not a number.")); } } - HashSet data = new HashSet<>(Arrays.asList(req.getParameterValues("assuredName"))); + String[] parameterValues = req.getParameterValues("assuredName"); + HashSet data = new HashSet<>(Arrays.asList(parameterValues == null ? new String[0] : parameterValues)); for (int i = 0; i < assureeNames.length; i++) { selected[i] = data.contains(Integer.toString(assureeNames[i].getId())); } @@ -175,16 +176,24 @@ public class AssuranceForm extends Form { if ( !gae.isEmpty()) { throw gae; } + + LinkedList toAssure = new LinkedList(); for (int i = 0; i < selected.length; i++) { if (selected[i]) { - Notary.assure(assurer, assuree, assureeNames[i], dob, pointsI, location, req.getParameter("date"), type); + toAssure.add(assureeNames[i]); } } + if (toAssure.size() == 0) { + throw new GigiApiException("You must confirm at least one name to verify an account."); + } + + Notary.assureAll(assurer, assuree, dob, pointsI, location, req.getParameter("date"), type, toAssure.toArray(new Name[toAssure.size()])); + if (aword != null && !aword.equals("")) { - Language l = Language.getInstance(assuree.getPreferredLocale()); - String method = l.getTranslation("A password reset was triggered. If you did a password reset by assurance, please enter your secret password using this form:"); - String subject = l.getTranslation("Password reset by assurance"); - PasswordResetPage.initPasswordResetProcess(out, assuree, req, aword, l, method, subject); + Language langApplicant = Language.getInstance(assuree.getPreferredLocale()); + String method = langApplicant.getTranslation("A password reset was triggered. If you did a password reset by verification, please enter your secret password using this form:"); + String subject = langApplicant.getTranslation("Password reset by verification"); + PasswordResetPage.initPasswordResetProcess(out, assuree, req, aword, langApplicant, method, subject); } return true; }