From: INOPIAE Date: Sat, 23 Jul 2016 12:08:31 +0000 (+0200) Subject: upd: extend add 100 assurance points to be flexible X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=5fa7ee6dd3c9109243c3d457f3357d94d7e2cca9 upd: extend add 100 assurance points to be flexible fixes issue #81 Change-Id: I72a3ac9e9ad6c0650a474dfc930f0bd0a61861a6 --- diff --git a/util-testing/org/cacert/gigi/pages/Manager.java b/util-testing/org/cacert/gigi/pages/Manager.java index 6889bfbe..c50fd709 100644 --- a/util-testing/org/cacert/gigi/pages/Manager.java +++ b/util-testing/org/cacert/gigi/pages/Manager.java @@ -265,19 +265,44 @@ public class Manager extends Page { resp.getWriter().println("Test '" + test.getDisplayName() + "' was added to user account."); } else if (req.getParameter("assure") != null) { String mail = req.getParameter("assureEmail"); + String verificationPoints = req.getParameter("verificationPoints"); User byEmail = User.getByEmail(mail); + if (byEmail == null) { resp.getWriter().println("User not found."); return; } + + int vp = 0; + int agentNumber = 0; + try { - for (int i = 0; i < 10; i++) { - Notary.assure(getAssurer(i), byEmail, byEmail.getPreferredName(), byEmail.getDoB(), 10, "Testmanager Assure up code", "2014-11-06", AssuranceType.FACE_TO_FACE); + try { + vp = Integer.parseInt(verificationPoints); + } catch (NumberFormatException e) { + throw new GigiApiException("No valid Verification Points entered."); } + + if (vp > 100) { // only allow max 100 Verification points + vp = 100; + } + + while (vp > 0) { + int currentVP = 10; + if (vp < 10) { + currentVP = vp; + } + Notary.assure(getAssurer(agentNumber), byEmail, byEmail.getPreferredName(), byEmail.getDoB(), currentVP, "Testmanager Assure up code", "2014-11-06", AssuranceType.FACE_TO_FACE); + agentNumber += 1; + vp -= currentVP; + } + } catch (GigiApiException e) { throw new Error(e); } - resp.getWriter().println("User has been assured."); + + resp.getWriter().println("User has been assured " + agentNumber + " times."); + } else if (req.getParameter("letassure") != null) { String mail = req.getParameter("letassureEmail"); User byEmail = User.getByEmail(mail); diff --git a/util-testing/org/cacert/gigi/pages/Manager.templ b/util-testing/org/cacert/gigi/pages/Manager.templ index d1cb1f62..affc73dd 100644 --- a/util-testing/org/cacert/gigi/pages/Manager.templ +++ b/util-testing/org/cacert/gigi/pages/Manager.templ @@ -57,7 +57,8 @@ Add 100 Assurance points: Email: - +Verification Points to issue: +