import club.wpia.gigi.pages.orga.CreateOrgPage;
import club.wpia.gigi.pages.orga.ViewOrgPage;
import club.wpia.gigi.pages.statistics.StatisticsRoles;
-import club.wpia.gigi.pages.wot.AssurePage;
+import club.wpia.gigi.pages.wot.VerifyPage;
import club.wpia.gigi.pages.wot.Points;
import club.wpia.gigi.pages.wot.RequestTTPPage;
import club.wpia.gigi.ping.PingerDaemon;
putPage(DomainOverview.PATH, new DomainOverview(), "Certificates");
putPage(EditDomain.PATH + "*", new EditDomain(), null);
- putPage(AssurePage.PATH + "/*", new AssurePage(), "Web of Trust");
+ putPage(VerifyPage.PATH + "/*", new VerifyPage(), "Web of Trust");
putPage(Points.PATH, new Points(false), "Web of Trust");
putPage(RequestTTPPage.PATH, new RequestTTPPage(), "Web of Trust");
}
try {
- putPage("/wot/rules", new StaticPage("Web of Trust Rules", AssurePage.class.getResourceAsStream("Rules.templ")), "Web of Trust");
+ putPage("/wot/rules", new StaticPage("Web of Trust Rules", VerifyPage.class.getResourceAsStream("Rules.templ")), "Web of Trust");
} catch (UnsupportedEncodingException e) {
throw new ServletException(e);
}
try (Link l = DatabaseConnection.newLink(false)) {
CACertificate.getById(1);
CertificateProfile.getById(1);
- CATSType.ASSURER_CHALLENGE.getDisplayName();
+ CATSType.AGENT_CHALLENGE.getDisplayName();
} catch (InterruptedException e) {
throw new Error(e);
}
jw.value(u1.getId());
jw.key("canAssure");
- jw.value(u1.canAssure());
+ jw.value(u1.canVerify());
jw.key("name");
jw.value(u1.getPreferredName().toAbbreviatedString());
public class CATS {
public enum CATSType {
- ASSURER_CHALLENGE("Agent Qualifying Challenge"),
+ AGENT_CHALLENGE("Agent Qualifying Challenge"),
ORG_AGENT_CHALLENGE("Organisation Agent Qualifying Challenge"),
}
for (String s : req) {
if (s.equals("points>=50")) {
- if (actor.getAssurancePoints() < 50) {
+ if (actor.getVerificationPoints() < 50) {
return false;
}
} else if (s.equals("points>=100")) {
- if (actor.getAssurancePoints() < 100) {
+ if (actor.getVerificationPoints() < 100) {
return false;
}
} else if (s.equals("codesign")) {
return scheme.toAbbreviatedString();
}
- public int getAssurancePoints() {
+ public int getVerificationPoints() {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT SUM(`points`) FROM (SELECT DISTINCT ON (`from`, `method`) `points` FROM `notary` WHERE `to`=? AND `deleted` IS NULL AND (`expire` IS NULL OR `expire` > CURRENT_TIMESTAMP) ORDER BY `from`, `method`, `when` DESC) AS p")) {
query.setInt(1, getId());
}
public synchronized void addAdmin(User admin, User actor, boolean master) throws GigiApiException {
- if ( !admin.canAssure()) {
+ if ( !admin.canVerify()) {
throw new GigiApiException("Cannot add person who is not RA Agent.");
}
if ( !actor.isInGroup(Group.ORGASSURER) && !isMaster(actor)) {
import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.database.GigiPreparedStatement;
import club.wpia.gigi.database.GigiResultSet;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
import club.wpia.gigi.dbObjects.CATS.CATSType;
import club.wpia.gigi.dbObjects.Country.CountryCodeType;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.DateSelector;
import club.wpia.gigi.pages.PasswordResetPage;
import club.wpia.gigi.util.TimeConditions;
/**
- * Represents an acting, assurable, user. Synchronizing on user means: no
- * name-change and no assurance.
+ * Represents an acting, verifiable user. Synchronizing on user means: no
+ * name-change and no verification.
*/
public class User extends CertificateOwner {
private String email;
- private Assurance[] receivedAssurances;
+ private Verification[] receivedVerifications;
- private Assurance[] madeAssurances;
+ private Verification[] madeVerifications;
private Locale locale;
public void setDoB(DayDate dob) throws GigiApiException {
synchronized (Notary.class) {
- if (getReceivedAssurances().length != 0) {
+ if (getReceivedVerifications().length != 0) {
throw new GigiApiException("No change after verification allowed.");
}
}
}
- public boolean canAssure() {
+ public boolean canVerify() {
if (POJAM_ENABLED) {
if ( !CalendarUtil.isOfAge(dob, POJAM_AGE)) { // PoJAM
return false;
return false;
}
}
- if (getAssurancePoints() < 100) {
+ if (getVerificationPoints() < 100) {
return false;
}
public boolean hasPassedCATS() {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT 1 FROM `cats_passed` where `user_id`=? AND `variant_id`=?")) {
query.setInt(1, getId());
- query.setInt(2, CATSType.ASSURER_CHALLENGE.getId());
+ query.setInt(2, CATSType.AGENT_CHALLENGE.getId());
try (GigiResultSet rs = query.executeQuery()) {
if (rs.next()) {
return true;
}
}
- public int getAssurancePoints() {
+ public int getVerificationPoints() {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT SUM(lastpoints) FROM ( SELECT DISTINCT ON (`from`, `method`) `from`, `points` as lastpoints FROM `notary` INNER JOIN `names` ON `names`.`id`=`to` WHERE `notary`.`deleted` is NULL AND (`expire` IS NULL OR `expire` > CURRENT_TIMESTAMP) AND `names`.`uid` = ? ORDER BY `from`, `method`, `when` DESC) as p")) {
query.setInt(1, getId());
public int getExperiencePoints() {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT count(*) FROM ( SELECT `names`.`uid` FROM `notary` INNER JOIN `names` ON `names`.`id` = `to` WHERE `from`=? AND `notary`.`deleted` IS NULL AND `method` = ? ::`notaryType` GROUP BY `names`.`uid`) as p")) {
query.setInt(1, getId());
- query.setEnum(2, AssuranceType.FACE_TO_FACE);
+ query.setEnum(2, VerificationType.FACE_TO_FACE);
GigiResultSet rs = query.executeQuery();
int points = 0;
}
/**
- * Gets the maximum allowed points NOW. Note that an assurance needs to
+ * Gets the maximum allowed points NOW. Note that a verification needs to
* re-check PoJam as it has taken place in the past.
*
* @return the maximal points @
*/
@SuppressWarnings("unused")
- public int getMaxAssurePoints() {
+ public int getMaxVerifyPoints() {
if ( !CalendarUtil.isOfAge(dob, ADULT_AGE) && POJAM_ENABLED) {
return 10; // PoJAM
}
public boolean isValidName(String name) {
for (Name n : getNames()) {
- if (n.matches(name) && n.getAssurancePoints() >= 50) {
+ if (n.matches(name) && n.getVerificationPoints() >= 50) {
return true;
}
}
throw new GigiApiException("Email not one of user's email addresses.");
}
- public synchronized Assurance[] getReceivedAssurances() {
- if (receivedAssurances == null) {
+ public synchronized Verification[] getReceivedVerifications() {
+ if (receivedVerifications == null) {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT * FROM `notary` INNER JOIN `names` ON `names`.`id` = `notary`.`to` WHERE `names`.`uid`=? AND `notary`.`deleted` IS NULL ORDER BY `when` DESC")) {
query.setInt(1, getId());
GigiResultSet res = query.executeQuery();
- List<Assurance> assurances = new LinkedList<Assurance>();
+ List<Verification> verifications = new LinkedList<Verification>();
while (res.next()) {
- assurances.add(assuranceByRes(res));
+ verifications.add(verificationByRes(res));
}
- this.receivedAssurances = assurances.toArray(new Assurance[0]);
+ this.receivedVerifications = verifications.toArray(new Verification[0]);
}
}
- return receivedAssurances;
+ return receivedVerifications;
}
- public synchronized Assurance[] getMadeAssurances() {
- if (madeAssurances == null) {
+ public synchronized Verification[] getMadeVerifications() {
+ if (madeVerifications == null) {
try (GigiPreparedStatement query = new GigiPreparedStatement("SELECT * FROM notary WHERE `from`=? AND deleted is NULL ORDER BY `when` DESC")) {
query.setInt(1, getId());
try (GigiResultSet res = query.executeQuery()) {
- List<Assurance> assurances = new LinkedList<Assurance>();
+ List<Verification> verifications = new LinkedList<Verification>();
while (res.next()) {
- assurances.add(assuranceByRes(res));
+ verifications.add(verificationByRes(res));
}
- this.madeAssurances = assurances.toArray(new Assurance[0]);
+ this.madeVerifications = verifications.toArray(new Verification[0]);
}
}
}
- return madeAssurances;
+ return madeVerifications;
}
- public synchronized void invalidateMadeAssurances() {
- madeAssurances = null;
+ public synchronized void invalidateMadeVerifications() {
+ madeVerifications = null;
}
- public synchronized void invalidateReceivedAssurances() {
- receivedAssurances = null;
+ public synchronized void invalidateReceivedVerifications() {
+ receivedVerifications = null;
}
private void rawUpdateUserData() {
}
}
- private Assurance assuranceByRes(GigiResultSet res) {
+ private Verification verificationByRes(GigiResultSet res) {
try {
- return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS), res.getTimestamp("expire"));
+ return new Verification(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS), res.getTimestamp("expire"));
} catch (GigiApiException e) {
throw new Error(e);
}
import club.wpia.gigi.dbObjects.wrappers.DataContainer;
@DataContainer
-public class Assurance {
+public class Verification {
- public enum AssuranceType implements DBEnum {
+ public enum VerificationType implements DBEnum {
FACE_TO_FACE("Face to Face Meeting"), TOPUP("TOPUP"), TTP_ASSISTED("TTP-Assisted"), NUCLEUS("Nucleus Bonus");
private final String description;
- private AssuranceType(String description) {
+ private VerificationType(String description) {
this.description = description;
}
private Date expireDate;
- public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) {
+ public Verification(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) {
this.id = id;
this.from = from;
this.to = to;
import java.io.PrintWriter;
import java.util.Map;
-import club.wpia.gigi.dbObjects.Assurance;
import club.wpia.gigi.dbObjects.Name;
+import club.wpia.gigi.dbObjects.Verification;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.template.IterableDataset;
import club.wpia.gigi.output.template.Outputable;
import club.wpia.gigi.output.template.Template;
-public class AssurancesDisplay implements Outputable {
+public class VerificationsDisplay implements Outputable {
- private static final Template template = new Template(AssurancesDisplay.class.getResource("AssurancesDisplay.templ"));
+ private static final Template template = new Template(VerificationsDisplay.class.getResource("VerificationsDisplay.templ"));
- private boolean assurer;
+ private boolean agent;
- public String assuranceArray;
+ public String verificationArray;
private boolean support;
- public AssurancesDisplay(String assuranceArray, boolean assurer, boolean support) {
- this.assuranceArray = assuranceArray;
- this.assurer = assurer;
+ public VerificationsDisplay(String verificationArray, boolean agent, boolean support) {
+ this.verificationArray = verificationArray;
+ this.agent = agent;
this.support = support;
}
@Override
public void output(PrintWriter out, Language l, Map<String, Object> vars) {
- final Assurance[] assurances = (Assurance[]) vars.get(assuranceArray);
- if (assurer) {
+ final Verification[] verifications = (Verification[]) vars.get(verificationArray);
+ if (agent) {
vars.put("verb", l.getTranslation("To (User Id)"));
vars.put("info", "");
} else {
vars.put("info", l.getTranslation("Coloured rows show expired nucleus bonus verifications which are not counted to the total of verification points."));
}
- IterableDataset assuranceGroup = new IterableDataset() {
+ IterableDataset verificationsGroup = new IterableDataset() {
private int i = 0;
@Override
public boolean next(Language l, Map<String, Object> vars) {
- if (i >= assurances.length) {
+ if (i >= verifications.length) {
return false;
} else {
- Assurance assurance = assurances[i];
+ Verification verification = verifications[i];
vars.put("support", support);
- vars.put("id", assurance.getId());
- vars.put("method", assurance.getMethod());
- Name to = assurance.getTo();
- if (assurer) {
+ vars.put("id", verification.getId());
+ vars.put("method", verification.getMethod());
+ Name to = verification.getTo();
+ if (agent) {
vars.put("linkId", to == null ? "" : to.getOwner().getId());
vars.put("verbVal", to == null ? l.getTranslation("applicant's name removed") : to.getOwner().getId());
vars.put("myName", to == null ? l.getTranslation("applicant's name removed") : to);
} else {
- vars.put("linkId", assurance.getFrom().getId());
- vars.put("verbVal", assurance.getFrom().getPreferredName());
+ vars.put("linkId", verification.getFrom().getId());
+ vars.put("verbVal", verification.getFrom().getPreferredName());
vars.put("myName", to == null ? l.getTranslation("own name removed") : to);
}
- vars.put("date", assurance.getDate());
- vars.put("location", assurance.getLocation() + " (" + (assurance.getCountry() == null ? l.getTranslation("not given") : assurance.getCountry().getName()) + ")");
- vars.put("points", assurance.getPoints());
- vars.put("expired", assurance.isExpired());
+ vars.put("date", verification.getDate());
+ vars.put("location", verification.getLocation() + " (" + (verification.getCountry() == null ? l.getTranslation("not given") : verification.getCountry().getName()) + ")");
+ vars.put("points", verification.getPoints());
+ vars.put("expired", verification.isExpired());
i++;
return true;
}
}
};
- vars.put("assurances", assuranceGroup);
+ vars.put("verifications", verificationsGroup);
template.output(out, l, vars);
}
<td><?=_Location?></td>
<td><?=_Method?></td>
</tr>
-<? foreach($assurances) {?>
+<? foreach($verifications) {?>
<tr <? if($expired) { ?> class="info" <? } ?> >
<? if($support) { ?>
<td><a href="/support/user/<?=$linkId?>/"><?=$id?></a></td>
public class MyDetailsForm extends Form {
- private static final Template assured = new Template(MyDetails.class.getResource("MyDetailsFormAssured.templ"));
+ private static final Template verified = new Template(MyDetails.class.getResource("MyDetailsFormVerified.templ"));
private static final Template templ = new Template(MyDetailsForm.class.getResource("MyDetailsForm.templ"));
}
vars.put("name", t);
vars.put("id", t.getId());
- vars.put("npoints", Integer.toString(t.getAssurancePoints()));
+ vars.put("npoints", Integer.toString(t.getVerificationPoints()));
}
});
names.output(out, l, vars);
vars.put("residenceCountry", cs);
- if (target.getReceivedAssurances().length == 0) {
+ if (target.getReceivedVerifications().length == 0) {
vars.put("DoB", ds);
templ.output(out, l, vars);
} else {
vars.put("DoB", target.getDoB());
- assured.output(out, l, vars);
+ verified.output(out, l, vars);
}
final Set<Group> gr = target.getGroups();
this.ctx = ctx;
if (cp != null) {
profile = cp;
- } else if (ctx.getActor().getAssurancePoints() > 50) {
+ } else if (ctx.getActor().getVerificationPoints() > 50) {
profile = CertificateProfile.getByName("client-a");
}
byte[] data = PEM.decode("(NEW )?CERTIFICATE REQUEST", csr);
} else if (c instanceof ExtendedKeyUsageExtension) {
ExtendedKeyUsageExtension ekue = (ExtendedKeyUsageExtension) c;
String appendix = "";
- if (ctx.getActor().getAssurancePoints() >= 50) {
+ if (ctx.getActor().getVerificationPoints() >= 50) {
appendix = "-a";
}
for (String s : ekue.getExtendedKeyUsage()) {
@Override
public void apply(Name t, Language l, Map<String, Object> vars) {
vars.put("name", t);
- vars.put("points", Integer.toString(t.getAssurancePoints()));
+ vars.put("points", Integer.toString(t.getVerificationPoints()));
}
});
- vars.put("assurer", user.canAssure());
+ vars.put("agent", user.canVerify());
vars.put("dob", dobSelector);
- vars.put("assurancepoints", user.getAssurancePoints());
+ vars.put("verificationPoints", user.getVerificationPoints());
vars.put("exppoints", user.getExperiencePoints());
final Set<Group> gr = user.getGroups();
vars.put("support-groups", new GroupIterator(gr.iterator(), true));
<tr>
<td><?=_Is RA Agent?>:</td>
<td>
- <? if($assurer) { ?>
+ <? if($agent) { ?>
<?=_Yes?>
<? } else { ?>
<?=_No?>
</tr>
<tr>
<td><?=_Verification Points?>:</td>
- <td><?=$assurancepoints?> (<a href="./points"><?=_Show?></a>)</td>
+ <td><?=$verificationPoints?> (<a href="./points"><?=_Show?></a>)</td>
</tr>
<tr>
<td><?=_Experience Points?>:</td>
}
} else if (req.getParameter("do_affiliate") != null) {
User byEmail = User.getByEmail(req.getParameter("email"));
- if (byEmail != null && byEmail.canAssure()) {
+ if (byEmail != null && byEmail.canVerify()) {
o.addAdmin(byEmail, LoginPage.getUser(req), req.getParameter("master") != null);
return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + o.getId());
} else {
public class CreateOrgPage extends ManagedFormPage {
- public static final Group ORG_ASSURER = Group.ORGASSURER;
+ public static final Group ORG_AGENT = Group.ORGASSURER;
public static final String DEFAULT_PATH = "/orga/new";
@Override
public boolean isPermitted(AuthorizationContext ac) {
- return ac != null && ac.isInGroup(ORG_ASSURER);
+ return ac != null && ac.isInGroup(ORG_AGENT);
}
@Override
@Override
public boolean isPermitted(AuthorizationContext ac) {
- return ac != null && (ac.isInGroup(CreateOrgPage.ORG_ASSURER) || ac.getActor().getOrganisations(true).size() != 0);
+ return ac != null && (ac.isInGroup(CreateOrgPage.ORG_AGENT) || ac.getActor().getOrganisations(true).size() != 0);
}
@Override
if (req.getParameter("do_affiliate") != null || req.getParameter("del") != null) {
return Form.getForm(req, AffiliationForm.class);
} else {
- if ( !getUser(req).isInGroup(CreateOrgPage.ORG_ASSURER)) {
+ if ( !getUser(req).isInGroup(CreateOrgPage.ORG_AGENT)) {
return null;
}
final Organisation[] orgList = Organisation.getOrganisations(0, 30);
HashMap<String, Object> map = new HashMap<>();
final List<Organisation> myOrgs = u.getOrganisations(true);
- final boolean orgAss = u.isInGroup(CreateOrgPage.ORG_ASSURER);
+ final boolean orgAss = u.isInGroup(CreateOrgPage.ORG_AGENT);
if (orgAss) {
map.put("orgas", makeOrgDataset(orgList));
} else {
return;
}
final List<Organisation> myOrgs = u.getOrganisations();
- final boolean orgAss = u.isInGroup(CreateOrgPage.ORG_ASSURER);
+ final boolean orgAss = u.isInGroup(CreateOrgPage.ORG_AGENT);
if ( !orgAss && !myOrgs.contains(o)) {
resp.sendError(404);
return;
import javax.servlet.http.HttpServletResponse;
import club.wpia.gigi.dbObjects.User;
-import club.wpia.gigi.output.AssurancesDisplay;
+import club.wpia.gigi.output.VerificationsDisplay;
import club.wpia.gigi.pages.Page;
import club.wpia.gigi.util.AuthorizationContext;
private boolean support;
- private AssurancesDisplay myDisplay;
+ private VerificationsDisplay myDisplay;
- private AssurancesDisplay toOtherDisplay;
+ private VerificationsDisplay toOtherDisplay;
public Points(boolean support) {
super(support ? "Support User Points" : "Points");
this.support = support;
- myDisplay = new AssurancesDisplay("asArr", false, support);
- toOtherDisplay = new AssurancesDisplay("otherAsArr", true, support);
+ myDisplay = new VerificationsDisplay("asArr", false, support);
+ toOtherDisplay = new VerificationsDisplay("otherAsArr", true, support);
}
@Override
vars.put("username", user.getPreferredName().toString());
vars.put("pointlist", myDisplay);
vars.put("madelist", toOtherDisplay);
- vars.put("asArr", user.getReceivedAssurances());
- vars.put("otherAsArr", user.getMadeAssurances());
- vars.put("assP", user.getAssurancePoints());
- if (user.canAssure()) {
+ vars.put("asArr", user.getReceivedVerifications());
+ vars.put("otherAsArr", user.getMadeVerifications());
+ vars.put("assP", user.getVerificationPoints());
+ if (user.canVerify()) {
vars.put("expP", user.getExperiencePoints());
- vars.put("maxP", user.getMaxAssurePoints());
+ vars.put("maxP", user.getMaxVerifyPoints());
}
getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import club.wpia.gigi.dbObjects.Assurance;
+import club.wpia.gigi.dbObjects.Verification;
import club.wpia.gigi.dbObjects.User;
import club.wpia.gigi.output.template.Form;
import club.wpia.gigi.pages.LoginPage;
if (u.isInGroup(RequestTTPForm.TTP_APPLICANT)) {
map.put("inProgress", true);
} else {
- if (u.getAssurancePoints() < 100) {
+ if (u.getVerificationPoints() < 100) {
int ttpCount = 0;
- for (Assurance a : u.getReceivedAssurances()) {
- if (a.getMethod().equals(Assurance.AssuranceType.TTP_ASSISTED.getDescription())) {
+ for (Verification a : u.getReceivedVerifications()) {
+ if (a.getMethod().equals(Verification.VerificationType.TTP_ASSISTED.getDescription())) {
ttpCount++;
}
}
import javax.servlet.http.HttpServletRequest;
import club.wpia.gigi.GigiApiException;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
import club.wpia.gigi.dbObjects.Name;
import club.wpia.gigi.dbObjects.User;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.ArrayIterable;
import club.wpia.gigi.output.CountrySelector;
import club.wpia.gigi.util.DayDate;
import club.wpia.gigi.util.Notary;
-public class AssuranceForm extends Form {
+public class VerificationForm extends Form {
public static class ConcatOutputable implements Outputable {
}
}
- private User assuree;
+ private User applicant;
- private Name[] assureeNames;
+ private Name[] applicantNames;
private boolean[] selected;
private String aword;
- private User assurer;
+ private User agent;
- private AssuranceType type = AssuranceType.FACE_TO_FACE;
+ private VerificationType type = VerificationType.FACE_TO_FACE;
- private static final Template templ = new Template(AssuranceForm.class.getResource("AssuranceForm.templ"));
+ private static final Template templ = new Template(VerificationForm.class.getResource("VerificationForm.templ"));
private CountrySelector cs;
- public AssuranceForm(HttpServletRequest hsr, User assuree) throws GigiApiException {
+ public VerificationForm(HttpServletRequest hsr, User applicant) throws GigiApiException {
super(hsr);
- assurer = Page.getUser(hsr);
- this.assuree = assuree;
+ agent = Page.getUser(hsr);
+ this.applicant = applicant;
- if (assurer.getId() == assuree.getId()) {
+ if (agent.getId() == applicant.getId()) {
throw new GigiApiException("You cannot verify yourself.");
}
- if ( !assurer.canAssure()) {
+ if ( !agent.canVerify()) {
throw new GigiApiException("You are not a RA-Agent.");
}
- Name[] initialNames = this.assuree.getNonDeprecatedNames();
+ Name[] initialNames = this.applicant.getNonDeprecatedNames();
LinkedList<Name> names = new LinkedList<>();
for (Name name : initialNames) {
- if (Notary.checkAssuranceIsPossible(assurer, name)) {
+ if (Notary.checkVerificationIsPossible(agent, name)) {
names.add(name);
}
}
if (names.size() == 0) {
throw new GigiApiException(SprintfCommand.createSimple("You have already verified all names of this applicant within the last {0} days.", Notary.LIMIT_DAYS_VERIFICATION));
}
- assureeNames = names.toArray(new Name[names.size()]);
- dob = this.assuree.getDoB();
- selected = new boolean[assureeNames.length];
+ applicantNames = names.toArray(new Name[names.size()]);
+ dob = this.applicant.getDoB();
+ selected = new boolean[applicantNames.length];
cs = new CountrySelector("countryCode", false);
}
public void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
HashMap<String, Object> res = new HashMap<String, Object>(vars);
res.putAll(vars);
- res.put("names", new ArrayIterable<Name>(assureeNames) {
+ res.put("names", new ArrayIterable<Name>(applicantNames) {
@Override
public void apply(Name t, Language l, Map<String, Object> vars) {
}
});
- res.put("name", assuree.getPreferredName().toString());
- res.put("maxpoints", assurer.getMaxAssurePoints());
- res.put("dob", sdf.format(assuree.getDoB().toDate()));
- res.put("dobFmt2", sdf2.format(assuree.getDoB().toDate()));
+ res.put("name", applicant.getPreferredName().toString());
+ res.put("maxpoints", agent.getMaxVerifyPoints());
+ res.put("dob", sdf.format(applicant.getDoB().toDate()));
+ res.put("dobFmt2", sdf2.format(applicant.getDoB().toDate()));
res.put("location", location);
res.put("date", date);
res.put("aword", aword);
res.put("countryCode", cs);
- final LinkedList<AssuranceType> ats = new LinkedList<>();
- for (AssuranceType at : AssuranceType.values()) {
+ final LinkedList<VerificationType> ats = new LinkedList<>();
+ for (VerificationType at : VerificationType.values()) {
try {
- Notary.may(assurer, assuree, at);
+ Notary.may(agent, applicant, at);
ats.add(at);
} catch (GigiApiException e) {
}
}
res.put("ats", new IterableDataset() {
- Iterator<AssuranceType> t = ats.iterator();
+ Iterator<VerificationType> t = ats.iterator();
@Override
public boolean next(Language l, Map<String, Object> vars) {
if ( !t.hasNext()) {
return false;
}
- AssuranceType t1 = t.next();
+ VerificationType t1 = t.next();
vars.put("type", t1.getDescription());
vars.put("id", t1.toString());
vars.put("sel", t1 == type ? " selected" : "");
} else {
aword = null;
}
- String val = req.getParameter("assuranceType");
+ String val = req.getParameter("verificationType");
if (val != null) {
try {
- type = AssuranceType.valueOf(val);
+ type = VerificationType.valueOf(val);
} catch (IllegalArgumentException e) {
gae.mergeInto(new GigiApiException("Verification Type wrong."));
}
gae.mergeInto(new GigiApiException("The points entered were not a number."));
}
}
- String[] parameterValues = req.getParameterValues("assuredName");
+ String[] parameterValues = req.getParameterValues("verifiedName");
HashSet<String> 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()));
+ for (int i = 0; i < applicantNames.length; i++) {
+ selected[i] = data.contains(Integer.toString(applicantNames[i].getId()));
}
if ( !gae.isEmpty()) {
LinkedList<Name> toAssure = new LinkedList<Name>();
for (int i = 0; i < selected.length; i++) {
if (selected[i]) {
- toAssure.add(assureeNames[i]);
+ toAssure.add(applicantNames[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()]), cs.getCountry());
+ Notary.verifyAll(agent, applicant, dob, pointsI, location, req.getParameter("date"), type, toAssure.toArray(new Name[toAssure.size()]), cs.getCountry());
Outputable result = new TranslateCommand("Verification complete.");
if (isWithPasswordReset()) {
- Language langApplicant = Language.getInstance(assuree.getPreferredLocale());
+ Language langApplicant = Language.getInstance(applicant.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(assuree, req, aword, langApplicant, method, subject);
+ PasswordResetPage.initPasswordResetProcess(applicant, req, aword, langApplicant, method, subject);
result = new ConcatOutputable(result, new TranslateCommand("Password reset successful."));
}
return new SuccessMessageResult(result);
return aword != null && !aword.equals("");
}
- public User getAssuree() {
- return assuree;
+ public User getApplicant() {
+ return applicant;
}
}
<? foreach($names) { ?>
<tr>
<td><?=_Name?>: </td>
- <td><input type="checkbox" name="assuredName" value="<?=$nameId?>"<?=$checked?>><span class="accountdetail"><?=$nameExplicit?></span></td>
+ <td><input type="checkbox" name="verifiedName" value="<?=$nameId?>"<?=$checked?>><span class="accountdetail"><?=$nameExplicit?></span></td>
</tr>
<? } ?>
<tr>
</tr>
<tr>
<td><?=_Type?></td>
- <td><select name="assuranceType"><? foreach($ats) { ?><option value="<?=$id?>"<?=$sel?>><?=$type?></option><? } ?></select></td>
+ <td><select name="verificationType"><? foreach($ats) { ?><option value="<?=$id?>"<?=$sel?>><?=$type?></option><? } ?></select></td>
</tr>
<tr>
<td><input type="checkbox" name="passwordReset" value="1" <? if($aword) { ?>checked<? } ?>></td>
import club.wpia.gigi.pages.Page;
import club.wpia.gigi.util.AuthorizationContext;
-public class AssurePage extends Page {
+public class VerifyPage extends Page {
- public static final String PATH = "/wot/assure";
+ public static final String PATH = "/wot/verify";
DateSelector ds = new DateSelector("day", "month", "year");
- private static final Template t = new Template(AssuranceForm.class.getResource("AssureeSearch.templ"));
+ private static final Template t = new Template(VerificationForm.class.getResource("ApplicantSearch.templ"));
- public AssurePage() {
+ public VerifyPage() {
super("Verify someone");
}
@Override
public boolean isPermitted(AuthorizationContext ac) {
- return ac != null && ac.canAssure();
+ return ac != null && ac.canVerify();
}
@Override
public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
if (req.getParameter("search") == null) {
- AssuranceForm form = Form.getForm(req, AssuranceForm.class);
+ VerificationForm form = Form.getForm(req, VerificationForm.class);
return form.submitExceptionProtected(req, resp);
}
return super.beforePost(req, resp);
PrintWriter out = resp.getWriter();
if (req.getParameter("search") == null) {
if (Form.printFormErrors(req, out)) {
- AssuranceForm form = Form.getForm(req, AssuranceForm.class);
+ VerificationForm form = Form.getForm(req, VerificationForm.class);
form.output(out, getLanguage(req), getDefaultVars(req));
}
return;
} else if (getUser(req).getId() == id) {
} else {
- User assuree = User.getById(id);
+ User applicant = User.getById(id);
try {
- new AssuranceForm(req, assuree).output(out, getLanguage(req), getDefaultVars(req));
+ new VerificationForm(req, applicant).output(out, getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
e.format(out, Page.getLanguage(req));
}
}
}
- public boolean canAssure() {
- return target instanceof User && ((User) target).canAssure();
+ public boolean canVerify() {
+ return target instanceof User && ((User) target).canVerify();
}
}
import club.wpia.gigi.dbObjects.Group;
import club.wpia.gigi.dbObjects.Name;
import club.wpia.gigi.dbObjects.User;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.ArrayIterable;
import club.wpia.gigi.output.DateSelector;
}
}
- public static boolean checkAssuranceIsPossible(User assurer, Name target) {
+ public static boolean checkVerificationIsPossible(User agent, Name target) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT 1 FROM `notary` where `to`=? and `from`=? and `method` = ? ::`notaryType` AND `deleted` IS NULL AND `when` > (now() - interval '1 days' * ?)")) {
ps.setInt(1, target.getId());
- ps.setInt(2, assurer.getId());
- ps.setEnum(3, AssuranceType.FACE_TO_FACE);
+ ps.setInt(2, agent.getId());
+ ps.setEnum(3, VerificationType.FACE_TO_FACE);
ps.setInt(4, LIMIT_DAYS_VERIFICATION);
GigiResultSet rs = ps.executeQuery();
return !rs.next();
}
}
- public static final Group ASSURER_BLOCKED = Group.BLOCKEDASSURER;
+ public static final Group AGENT_BLOCKED = Group.BLOCKEDASSURER;
- public static final Group ASSUREE_BLOCKED = Group.BLOCKEDASSUREE;
+ public static final Group APPLICANT_BLOCKED = Group.BLOCKEDASSUREE;
public static final Group VERIFY_NOTIFICATION = Group.VERIFY_NOTIFICATION;
/**
- * This method assures another user.
+ * This method verifies another user.
*
- * @see User#canAssure() (for assurer)
- * @see #checkAssuranceIsPossible(User, User) (for assurer or assuree)
- * @param assurer
- * the person that wants to assure
- * @param assuree
- * the person that should be assured
- * @param assureeName
+ * @see User#canVerify() (for agent)
+ * @see #checkVerificationIsPossible(User, User) (for agent or applicant)
+ * @param agent
+ * the person that wants to verify
+ * @param applicant
+ * the person that should be verified
+ * @param applicantName
* the Name that was personally verified
* @param dob
- * the Date of birth that the assurer verified
+ * the Date of birth that the agent verified
* @param awarded
* the points that should be awarded in total
* @param location
- * the location where the assurance took place
+ * the location where the verification took place
* @param date
- * the date when the assurance took place
+ * the date when the verification took place
* @throws GigiApiException
- * if the assurance fails (for various reasons)
+ * if the verification fails (for various reasons)
*/
- public synchronized static void assure(User assurer, User assuree, Name assureeName, DayDate dob, int awarded, String location, String date, AssuranceType type, Country country) throws GigiApiException {
- may(assurer, assuree, AssuranceType.FACE_TO_FACE);
+ public synchronized static void verify(User agent, User applicant, Name applicantName, DayDate dob, int awarded, String location, String date, VerificationType type, Country country) throws GigiApiException {
+ may(agent, applicant, VerificationType.FACE_TO_FACE);
GigiApiException gae = new GigiApiException();
if ( !gae.isEmpty()) {
throw gae;
gae.mergeInto(new GigiApiException("You failed to enter the country of your meeting."));
}
- synchronized (assuree) {
- if (assurer.getId() == assuree.getId()) {
+ synchronized (applicant) {
+ if (agent.getId() == applicant.getId()) {
throw new GigiApiException("You cannot verify yourself.");
}
- if (assureeName.getOwner() != assuree) {
+ if (applicantName.getOwner() != applicant) {
throw new GigiApiException("Internal error, name does not belong to applicant.");
}
- if ( !assurer.canAssure()) {
+ if ( !agent.canVerify()) {
throw new GigiApiException("You are not an RA-Agent.");
}
- if ( !checkAssuranceIsPossible(assurer, assureeName)) {
+ if ( !checkVerificationIsPossible(agent, applicantName)) {
gae.mergeInto(new GigiApiException(SprintfCommand.createSimple("You have already verified this applicant within the last {0} days.", LIMIT_DAYS_VERIFICATION)));
}
- if ( !assuree.getDoB().equals(dob)) {
+ if ( !applicant.getDoB().equals(dob)) {
gae.mergeInto(new GigiApiException("The person you are verifying changed his personal details."));
}
if (awarded < 0) {
gae.mergeInto(new GigiApiException("The points you are trying to award are out of range."));
} else {
- if (type == AssuranceType.NUCLEUS) {
+ if (type == VerificationType.NUCLEUS) {
if (awarded > 50) {
gae.mergeInto(new GigiApiException("The points you are trying to award are out of range."));
}
} else {
- if (awarded > assurer.getMaxAssurePoints()) {
+ if (awarded > agent.getMaxVerifyPoints()) {
gae.mergeInto(new GigiApiException("The points you are trying to award are out of range."));
}
}
throw gae;
}
- if (type == AssuranceType.FACE_TO_FACE) {
- assureF2F(assurer, assuree, assureeName, awarded, location, date, country);
- } else if (type == AssuranceType.NUCLEUS) {
- assureNucleus(assurer, assuree, assureeName, awarded, location, date, country);
- } else if (type == AssuranceType.TTP_ASSISTED) {
- assureTTP(assurer, assuree, assureeName, awarded, location, date, country);
+ if (type == VerificationType.FACE_TO_FACE) {
+ verifyF2F(agent, applicant, applicantName, awarded, location, date, country);
+ } else if (type == VerificationType.NUCLEUS) {
+ verifyNucleus(agent, applicant, applicantName, awarded, location, date, country);
+ } else if (type == VerificationType.TTP_ASSISTED) {
+ verifyTTP(agent, applicant, applicantName, awarded, location, date, country);
} else {
throw new GigiApiException(SprintfCommand.createSimple("Unknown Verification type: {0}", type.toString()));
}
- assurer.invalidateMadeAssurances();
- assuree.invalidateReceivedAssurances();
+ agent.invalidateMadeVerifications();
+ applicant.invalidateReceivedVerifications();
}
}
- private static void assureF2F(User assurer, User assuree, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
- may(assurer, assuree, AssuranceType.FACE_TO_FACE);
+ private static void verifyF2F(User agent, User applicant, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
+ may(agent, applicant, VerificationType.FACE_TO_FACE);
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `country`=?")) {
- ps.setInt(1, assurer.getId());
+ ps.setInt(1, agent.getId());
ps.setInt(2, name.getId());
ps.setInt(3, awarded);
ps.setString(4, location);
}
}
- private static void assureTTP(User assurer, User assuree, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
- may(assurer, assuree, AssuranceType.TTP_ASSISTED);
+ private static void verifyTTP(User agent, User applicant, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
+ may(agent, applicant, VerificationType.TTP_ASSISTED);
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `country`=?, `method`='TTP-Assisted'")) {
- ps.setInt(1, assurer.getId());
+ ps.setInt(1, agent.getId());
ps.setInt(2, name.getId());
ps.setInt(3, awarded);
ps.setString(4, location);
ps.setString(5, date);
ps.setString(6, country.getCode());
ps.execute();
- assuree.revokeGroup(assurer, Group.TTP_APPLICANT);
+ applicant.revokeGroup(agent, Group.TTP_APPLICANT);
}
}
- public static void may(User assurer, User assuree, AssuranceType t) throws GigiApiException {
- if (assuree.isInGroup(ASSUREE_BLOCKED)) {
+ public static void may(User agent, User applicant, VerificationType t) throws GigiApiException {
+ if (applicant.isInGroup(APPLICANT_BLOCKED)) {
throw new GigiApiException("The applicant is blocked.");
}
- if (assurer.isInGroup(ASSURER_BLOCKED)) {
+ if (agent.isInGroup(AGENT_BLOCKED)) {
throw new GigiApiException("The RA Agent is blocked.");
}
- if (t == AssuranceType.NUCLEUS) {
- if ( !assurer.isInGroup(Group.NUCLEUS_ASSURER)) {
+ if (t == VerificationType.NUCLEUS) {
+ if ( !agent.isInGroup(Group.NUCLEUS_ASSURER)) {
throw new GigiApiException("RA Agent needs to be Nucleus RA Agent.");
}
return;
- } else if (t == AssuranceType.TTP_ASSISTED) {
- if ( !assurer.isInGroup(Group.TTP_ASSURER)) {
+ } else if (t == VerificationType.TTP_ASSISTED) {
+ if ( !agent.isInGroup(Group.TTP_ASSURER)) {
throw new GigiApiException("RA Agent needs to be TTP RA Agent.");
}
- if ( !assuree.isInGroup(Group.TTP_APPLICANT)) {
+ if ( !applicant.isInGroup(Group.TTP_APPLICANT)) {
throw new GigiApiException("Applicant needs to be TTP Applicant.");
}
return;
- } else if (t == AssuranceType.FACE_TO_FACE) {
+ } else if (t == VerificationType.FACE_TO_FACE) {
return;
}
throw new GigiApiException("Verification type not possible.");
}
- private static void assureNucleus(User assurer, User assuree, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
- may(assurer, assuree, AssuranceType.NUCLEUS);
+ private static void verifyNucleus(User agent, User applicant, Name name, int awarded, String location, String date, Country country) throws GigiApiException {
+ may(agent, applicant, VerificationType.NUCLEUS);
// Do up to 35 points as f2f
- int f2fPoints = Math.min(assurer.getMaxAssurePoints(), awarded);
- assureF2F(assurer, assuree, name, f2fPoints, location, date, country);
+ int f2fPoints = Math.min(agent.getMaxVerifyPoints(), awarded);
+ verifyF2F(agent, applicant, name, f2fPoints, location, date, country);
awarded -= f2fPoints;
if (awarded <= 0) {
return;
}
- // Assure remaining points as "Nucleus Bonus"
+ // Verify remaining points as "Nucleus Bonus"
// Valid for 4 Weeks = 28 days
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `country`=?, `method`='Nucleus Bonus', `expire` = CURRENT_TIMESTAMP + interval '28 days'")) {
- ps.setInt(1, assurer.getId());
+ ps.setInt(1, agent.getId());
ps.setInt(2, name.getId());
ps.setInt(3, awarded);
ps.setString(4, location);
}
}
- public synchronized static void assureAll(User assurer, User assuree, DayDate dob, int awarded, String location, String date, AssuranceType type, Name[] toAssure, Country country) throws GigiApiException {
- if (toAssure.length == 0) {
+ public synchronized static void verifyAll(User agent, User applicant, DayDate dob, int awarded, String location, String date, VerificationType type, Name[] toVerify, Country country) throws GigiApiException {
+ if (toVerify.length == 0) {
throw new GigiApiException("You must confirm at least one name to verify an account.");
}
- boolean[] hadLessThan50Points = new boolean[toAssure.length];
- boolean hadTotalLessThan100 = assuree.getAssurancePoints() < 100;
- for (int i = 0; i < toAssure.length; i++) {
- hadLessThan50Points[i] = toAssure[i].getAssurancePoints() < 50;
+ boolean[] hadLessThan50Points = new boolean[toVerify.length];
+ boolean hadTotalLessThan100 = applicant.getVerificationPoints() < 100;
+ for (int i = 0; i < toVerify.length; i++) {
+ hadLessThan50Points[i] = toVerify[i].getVerificationPoints() < 50;
- assure(assurer, assuree, toAssure[i], dob, awarded, location, date, type, country);
+ verify(agent, applicant, toVerify[i], dob, awarded, location, date, type, country);
}
- sendVerificationNotificationApplicant(assurer, assuree, toAssure, awarded, hadLessThan50Points, hadTotalLessThan100);
- if (assurer.isInGroup(VERIFY_NOTIFICATION)) {
- sendVerificationNotificationAgent(assurer, assuree, toAssure, awarded, location, date, country);
+ sendVerificationNotificationApplicant(agent, applicant, toVerify, awarded, hadLessThan50Points, hadTotalLessThan100);
+ if (agent.isInGroup(VERIFY_NOTIFICATION)) {
+ sendVerificationNotificationAgent(agent, applicant, toVerify, awarded, location, date, country);
}
}
private static final MailTemplate verificationAgentEntered = new MailTemplate(Notary.class.getResource("VerificationAgentEntered.templ"));
- private static void sendVerificationNotificationApplicant(User assurer, User assuree, Name[] toAssure, final int awarded, final boolean[] hadLessThan50Points, boolean hadTotalLessThan100) {
+ private static void sendVerificationNotificationApplicant(User agent, User applicant, Name[] toVerify, final int awarded, final boolean[] hadLessThan50Points, boolean hadTotalLessThan100) {
HashMap<String, Object> mailVars = new HashMap<>();
- mailVars.put("agent", assurer.getPreferredName().toString());
- mailVars.put("names", new ArrayIterable<Name>(toAssure) {
+ mailVars.put("agent", agent.getPreferredName().toString());
+ mailVars.put("names", new ArrayIterable<Name>(toVerify) {
@Override
public void apply(Name t, Language l, Map<String, Object> vars) {
- int totalVP = t.getAssurancePoints();
+ int totalVP = t.getVerificationPoints();
vars.put("name", t.toString());
vars.put("points", Integer.toString(awarded));
vars.put("total", totalVP);
});
- int grandTotalVP = assuree.getAssurancePoints();
+ int grandTotalVP = applicant.getVerificationPoints();
if (grandTotalVP >= 50 && grandTotalVP < 100) {
mailVars.put("remAll", (100 - grandTotalVP));
mailVars.remove("gotGreaterAll");
mailVars.remove("remAll");
}
try {
- verificationEntered.sendMail(Language.getInstance(assuree.getPreferredLocale()), mailVars, assuree.getEmail());
+ verificationEntered.sendMail(Language.getInstance(applicant.getPreferredLocale()), mailVars, applicant.getEmail());
} catch (IOException e) {
e.printStackTrace();
}
@Test
public void testAddRm() throws GigiApiException, IOException {
- User u1 = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
+ User u1 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
u1.grantGroup(getSupporter(), Group.ORGASSURER);
- User u2 = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
+ User u2 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
u2.grantGroup(getSupporter(), Group.ORGASSURER);
- User u3 = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
+ User u3 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
u3.grantGroup(getSupporter(), Group.ORGASSURER);
- User u4 = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
+ User u4 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
u4.grantGroup(getSupporter(), Group.ORGASSURER);
Organisation o1 = new Organisation("name", Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS), "prov", "city", "email", "optional name", "postal address", u1);
assertEquals(0, o1.getAllAdmins().size());
@Test
public void testSeparateScope() throws IOException, GeneralSecurityException, SQLException, InterruptedException, GigiApiException {
String mail = "thisgo" + createUniqueName() + "@example.com";
- int user = createAssuranceUser("test", "tugo", mail, TEST_PASSWORD);
+ int user = createVerificationUser("test", "tugo", mail, TEST_PASSWORD);
String cookie = login(mail, TEST_PASSWORD);
KeyPair kp = generateKeypair();
String csr = generatePEMCSR(kp, "CN=hans");
@Test
public void testSerialSteal() throws IOException, GeneralSecurityException, SQLException, InterruptedException, GigiApiException {
String mail = "thisgo" + createUniqueName() + "@example.com";
- int user = createAssuranceUser("test", "tugo", mail, TEST_PASSWORD);
+ int user = createVerificationUser("test", "tugo", mail, TEST_PASSWORD);
KeyPair kp = generateKeypair();
String csr = generatePEMCSR(kp, "CN=hans");
User u = User.getById(user);
import org.hamcrest.CoreMatchers;
import org.junit.Test;
-import club.wpia.gigi.dbObjects.Assurance;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
+import club.wpia.gigi.dbObjects.Verification;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.dbObjects.Country;
import club.wpia.gigi.dbObjects.Country.CountryCodeType;
import club.wpia.gigi.dbObjects.Domain;
}
@Test
- public void testAssurerUtilMethods() throws SQLException, GigiApiException {
- int id = createAssuranceUser("aä", "b", createUniqueName() + "a@email.org", TEST_PASSWORD);
+ public void testAgentUtilMethods() throws SQLException, GigiApiException {
+ int id = createVerificationUser("aä", "b", createUniqueName() + "a@email.org", TEST_PASSWORD);
User u = User.getById(id);
- assertTrue(u.canAssure());
- int assurancePoints = u.getAssurancePoints();
+ assertTrue(u.canVerify());
+ int verificationPoints = u.getVerificationPoints();
int expPoints = u.getExperiencePoints();
- assertEquals(100, assurancePoints);
+ assertEquals(100, verificationPoints);
assertEquals(User.EXPERIENCE_POINTS, expPoints);
assertTrue(u.hasPassedCATS());
- assertEquals(10, u.getMaxAssurePoints());
+ assertEquals(10, u.getMaxVerifyPoints());
}
@Test
User[] us = new User[5];
for (int i = 0; i < us.length; i++) {
- us[i] = User.getById(createAssuranceUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
- Notary.assure(us[i], u, u.getPreferredName(), u.getDoB(), 10, "here", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ us[i] = User.getById(createVerificationUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
+ Notary.verify(us[i], u, u.getPreferredName(), u.getDoB(), 10, "here", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
}
assertTrue(u.isValidName("aä b"));
long d = System.currentTimeMillis();
d -= d % DayDate.MILLI_DAY;
User u = createUser("f", "l", createUniqueName() + "@example.org", TEST_PASSWORD);
- Assurance[] ma = u.getMadeAssurances();
- Assurance[] ma2 = u.getMadeAssurances();
- Assurance[] ra = u.getReceivedAssurances();
- Assurance[] ra2 = u.getReceivedAssurances();
+ Verification[] ma = u.getMadeVerifications();
+ Verification[] ma2 = u.getMadeVerifications();
+ Verification[] ra = u.getReceivedVerifications();
+ Verification[] ra2 = u.getReceivedVerifications();
assertEquals(0, u.getCertificates(false).length);
assertEquals(0, ma.length);
assertEquals(0, ma2.length);
apiImport(u2, "Test Training");
assertEquals(1, u2.getTrainings().length);
assertFalse(u2.hasPassedCATS());
- apiImport(u2, CATSType.ASSURER_CHALLENGE.getDisplayName());
+ apiImport(u2, CATSType.AGENT_CHALLENGE.getDisplayName());
assertEquals(2, u2.getTrainings().length);
assertTrue(u2.hasPassedCATS());
}
@Test
- public void testIssueCertAssured() throws Exception {
- makeAssurer(id);
+ public void testIssueCertVerified() throws Exception {
+ makeAgent(id);
String intendedName = "a b";
String cert = issueCert(generatePEMCSR(kp, "EMAIL=" + email + ",CN=" + intendedName), "profile=client-a");
@Test
public void testIssueOrgCert() throws Exception {
- makeAssurer(id);
+ makeAgent(id);
u.grantGroup(getSupporter(), Group.ORGASSURER);
Organisation o1 = new Organisation("name", Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS), "pr", "st", "test@mail", "", "", u);
+++ /dev/null
-package club.wpia.gigi.dbObjects;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import club.wpia.gigi.GigiApiException;
-import club.wpia.gigi.dbObjects.Country;
-import club.wpia.gigi.dbObjects.Name;
-import club.wpia.gigi.dbObjects.NamePart;
-import club.wpia.gigi.dbObjects.User;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
-import club.wpia.gigi.dbObjects.Country.CountryCodeType;
-import club.wpia.gigi.dbObjects.NamePart.NamePartType;
-import club.wpia.gigi.testUtils.ClientBusinessTest;
-import club.wpia.gigi.util.Notary;
-
-public class TestAssureName extends ClientBusinessTest {
-
- @Test
- public void testIt() throws GigiApiException {
- User u0 = User.getById(createAssuranceUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
- Name n2 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaa"));
- Name n3 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaa"));
- Name n4 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaac"));
-
- assertEquals(0, n0.getAssurancePoints());
- Notary.assure(u0, u, n0, u.getDoB(), 10, "test mgr", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- assertEquals(10, n0.getAssurancePoints());
- Notary.assure(u0, u, n2, u.getDoB(), 10, "test mgr", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- assertEquals(10, n2.getAssurancePoints());
- Notary.assure(u0, u, n3, u.getDoB(), 10, "test mgr", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- assertEquals(10, n3.getAssurancePoints());
- Notary.assure(u0, u, n4, u.getDoB(), 10, "test mgr", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- assertEquals(10, n4.getAssurancePoints());
- assertEquals(10, u.getMaxAssurePoints());
- }
-}
@Test
public void testRAChallenge() throws IOException, GeneralSecurityException {
- CATS.enterResult(u, CATSType.ASSURER_CHALLENGE, min12month, "en_US", "1");
- assertFalse(CATS.isInCatsLimit(id, CATSType.ASSURER_CHALLENGE.getId()));
- CATS.enterResult(u, CATSType.ASSURER_CHALLENGE, min11month, "en_US", "1");
- assertTrue(CATS.isInCatsLimit(id, CATSType.ASSURER_CHALLENGE.getId()));
+ CATS.enterResult(u, CATSType.AGENT_CHALLENGE, min12month, "en_US", "1");
+ assertFalse(CATS.isInCatsLimit(id, CATSType.AGENT_CHALLENGE.getId()));
+ CATS.enterResult(u, CATSType.AGENT_CHALLENGE, min11month, "en_US", "1");
+ assertTrue(CATS.isInCatsLimit(id, CATSType.AGENT_CHALLENGE.getId()));
}
@Test
import club.wpia.gigi.util.DayDate;
import club.wpia.gigi.util.Notary;
-public class TestAssurance extends BusinessTest {
+public class TestVerification extends BusinessTest {
private final Timestamp yesterday = new Timestamp(System.currentTimeMillis() - DayDate.MILLI_DAY);
private int applicantMultID;
- public TestAssurance() throws GigiApiException {
+ public TestVerification() throws GigiApiException {
}
// test for verification in 39 month period
- private void enterAssurance(int agentID, int applicantID) {
+ private void enterVerification(int agentID, int applicantID) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?")) {
ps.setInt(1, agentID);
ps.setInt(2, applicantID);
}
}
- private void enterAssuranceExpired(int agentID, int applicantID, Timestamp expired) {
+ private void enterVerificationExpired(int agentID, int applicantID, Timestamp expired) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `expire`=? ")) {
ps.setInt(1, agentID);
ps.setInt(2, applicantID);
}
}
- private void enterAssuranceWhen(int agentID, int applicantID, Timestamp when) {
+ private void enterVerificationWhen(int agentID, int applicantID, Timestamp when) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
ps.setInt(1, agentID);
ps.setInt(2, applicantID);
}
}
- private void enterAssuranceWhen(int agentID, int applicantID, Timestamp when, int points) {
+ private void enterVericationWhen(int agentID, int applicantID, Timestamp when, int points) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
ps.setInt(1, agentID);
ps.setInt(2, applicantID);
}
}
- private void enterAssuranceDeleted(int agentID, int applicantID, Timestamp deleted) {
+ private void enterVerificationDeleted(int agentID, int applicantID, Timestamp deleted) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `deleted`=? ")) {
ps.setInt(1, agentID);
ps.setInt(2, applicantID);
@Before
public void initTest() throws GigiApiException {
- agentID = createAssuranceUser("a", "b", createUniqueName() + "@example.com", TEST_PASSWORD);
- agent2ID = createAssuranceUser("a", "d", createUniqueName() + "@example.com", TEST_PASSWORD);
+ agentID = createVerificationUser("a", "b", createUniqueName() + "@example.com", TEST_PASSWORD);
+ agent2ID = createVerificationUser("a", "d", createUniqueName() + "@example.com", TEST_PASSWORD);
applicantID = createVerifiedUser("a", "c", createUniqueName() + "@example.com", TEST_PASSWORD);
applicant = User.getById(applicantID);
applicantNameID = User.getById(applicantID).getPreferredName().getId();
@Test
public void testVerificationYesterday() throws IOException {
- enterAssuranceWhen(agentID, applicantNameID, yesterday);
+ enterVerificationWhen(agentID, applicantNameID, yesterday);
assertTrue(applicant.isInVerificationLimit());
}
@Test
public void testApprox24MonthAgo() throws IOException {
- enterAssuranceWhen(agentID, applicantNameID, min24month);
+ enterVerificationWhen(agentID, applicantNameID, min24month);
assertTrue(applicant.isInVerificationLimit());
}
@Test
public void testApprox39MonthAgo() throws IOException {
- enterAssuranceWhen(agentID, applicantNameID, min39month);
+ enterVerificationWhen(agentID, applicantNameID, min39month);
assertFalse(applicant.isInVerificationLimit());
}
@Test
public void testTomorrowExpired() throws IOException {
- enterAssuranceExpired(agentID, applicantNameID, tomorrow);
+ enterVerificationExpired(agentID, applicantNameID, tomorrow);
assertTrue(applicant.isInVerificationLimit());
}
@Test
public void testYesterdayExpired() throws IOException {
- enterAssuranceExpired(agentID, applicantNameID, yesterday);
+ enterVerificationExpired(agentID, applicantNameID, yesterday);
assertFalse(applicant.isInVerificationLimit());
}
@Test
public void testNormal() throws IOException {
- enterAssurance(agentID, applicantNameID);
+ enterVerification(agentID, applicantNameID);
assertTrue(applicant.isInVerificationLimit());
}
@Test
public void testDeletedYesterday() throws IOException {
- enterAssuranceDeleted(agentID, applicantNameID, yesterday);
+ enterVerificationDeleted(agentID, applicantNameID, yesterday);
assertFalse(applicant.isInVerificationLimit());
}
@Test
- public void testMultipleAssurancePossible() throws IOException {
+ public void testMultipleVerificationPossible() throws IOException {
User agent = User.getById(agentID);
User applicantMult = User.getById(applicantMultID);
- enterAssuranceWhen(agentID, applicantMult.getPreferredName().getId(), min39month);
+ enterVerificationWhen(agentID, applicantMult.getPreferredName().getId(), min39month);
// test that new entry would be possible
- assertTrue(Notary.checkAssuranceIsPossible(agent, applicantMult.getPreferredName()));
+ assertTrue(Notary.checkVerificationIsPossible(agent, applicantMult.getPreferredName()));
// enter new entry
- enterAssuranceWhen(agentID, applicantMult.getPreferredName().getId(), yesterday);
+ enterVerificationWhen(agentID, applicantMult.getPreferredName().getId(), yesterday);
// test that new entry is not possible
- assertFalse(Notary.checkAssuranceIsPossible(agent, applicantMult.getPreferredName()));
+ assertFalse(Notary.checkVerificationIsPossible(agent, applicantMult.getPreferredName()));
}
@Test
- public void testMultipleAssurancePointsCalculation() throws IOException {
+ public void testMultipleVerificationPointsCalculation() throws IOException {
User agent = User.getById(agentID);
User applicantMult = User.getById(applicantMultID);
- enterAssuranceWhen(agentID, applicantMult.getPreferredName().getId(), min39month);
+ enterVerificationWhen(agentID, applicantMult.getPreferredName().getId(), min39month);
int xPoints = agent.getExperiencePoints();
// test that VP after first entry
- assertEquals(applicantMult.getAssurancePoints(), 10);
+ assertEquals(applicantMult.getVerificationPoints(), 10);
// enter second entry to check correct calculation with larger points
- enterAssuranceWhen(agentID, applicantMult.getPreferredName().getId(), min24month, 20);
- assertEquals(applicantMult.getAssurancePoints(), 20);
+ enterVericationWhen(agentID, applicantMult.getPreferredName().getId(), min24month, 20);
+ assertEquals(applicantMult.getVerificationPoints(), 20);
// test correct XP calculation
assertEquals(agent.getExperiencePoints(), xPoints);
// enter third entry to check correct calculation with less points
- enterAssuranceWhen(agentID, applicantMult.getPreferredName().getId(), yesterday, 15);
- assertEquals(applicantMult.getAssurancePoints(), 15);
+ enterVericationWhen(agentID, applicantMult.getPreferredName().getId(), yesterday, 15);
+ assertEquals(applicantMult.getVerificationPoints(), 15);
// test correct XP calculation
assertEquals(agent.getExperiencePoints(), xPoints);
// enter expired entry
- enterAssuranceExpired(agentID, applicantMult.getPreferredName().getId(), yesterday);
- assertEquals(applicantMult.getAssurancePoints(), 15);
+ enterVerificationExpired(agentID, applicantMult.getPreferredName().getId(), yesterday);
+ assertEquals(applicantMult.getVerificationPoints(), 15);
// enter deleted entry same agent
- enterAssuranceDeleted(agentID, applicantMult.getPreferredName().getId(), yesterday);
- assertEquals(applicantMult.getAssurancePoints(), 15);
+ enterVerificationDeleted(agentID, applicantMult.getPreferredName().getId(), yesterday);
+ assertEquals(applicantMult.getVerificationPoints(), 15);
// enter expired entry future
- enterAssuranceExpired(agentID, applicantMult.getPreferredName().getId(), tomorrow);
- assertEquals(applicantMult.getAssurancePoints(), 10);
+ enterVerificationExpired(agentID, applicantMult.getPreferredName().getId(), tomorrow);
+ assertEquals(applicantMult.getVerificationPoints(), 10);
// test correct XP calculation
assertEquals(agent.getExperiencePoints(), xPoints);
// enter entry from different agent
- enterAssuranceWhen(agent2ID, applicantMult.getPreferredName().getId(), yesterday);
- assertEquals(applicantMult.getAssurancePoints(), 20);
+ enterVerificationWhen(agent2ID, applicantMult.getPreferredName().getId(), yesterday);
+ assertEquals(applicantMult.getVerificationPoints(), 20);
// enter entry for second applicant
- enterAssuranceWhen(agentID, applicant.getPreferredName().getId(), yesterday);
+ enterVerificationWhen(agentID, applicant.getPreferredName().getId(), yesterday);
assertEquals(agent.getExperiencePoints(), xPoints + User.EXPERIENCE_POINTS);
}
import club.wpia.gigi.dbObjects.Name;
import club.wpia.gigi.dbObjects.NamePart;
import club.wpia.gigi.dbObjects.User;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.dbObjects.Country.CountryCodeType;
import club.wpia.gigi.dbObjects.NamePart.NamePartType;
import club.wpia.gigi.testUtils.BusinessTest;
import club.wpia.gigi.util.DayDate;
import club.wpia.gigi.util.Notary;
-public class TestAssuranceMail extends BusinessTest {
+public class TestVerificationMail extends BusinessTest {
private User agent;
private String message;
private void newAgent() throws GigiApiException {
- agent = User.getById(createAssuranceUser("Marianne", "Mustermann", createUniqueName() + "@example.com", TEST_PASSWORD));
+ agent = User.getById(createVerificationUser("Marianne", "Mustermann", createUniqueName() + "@example.com", TEST_PASSWORD));
}
private void newApplicant() throws GigiApiException {
int applicantId = createVerifiedUser("John", "Doe", applicantT, TEST_PASSWORD);
User applicantXP = User.getById(applicantId);
applicantXP = User.getById(applicantId);
- Notary.assure(agentXP, applicantXP, applicantXP.getNames()[0], applicantXP.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agentXP, applicantXP, applicantXP.getNames()[0], applicantXP.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
}
}
}
private void enterVerification(int points, Name... names) throws GigiApiException {
- Notary.assureAll(agent, applicant, applicant.getDoB(), points, createUniqueName(), validVerificationDateString(), AssuranceType.FACE_TO_FACE, names, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verifyAll(agent, applicant, applicant.getDoB(), points, createUniqueName(), validVerificationDateString(), VerificationType.FACE_TO_FACE, names, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
}
private void enterVerificationInPast(int points, Name name) {
// verify with 35 VP
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- Notary.assure(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- Notary.assure(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- Notary.assure(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 5, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
- Notary.assure(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 5, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 5, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[1], applicant.getDoB(), 5, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
// add first Verification in the past result first name 45 VP
newAgent();
// verify first name to 85 VP
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 10, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
newAgent();
- Notary.assure(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 5, "Test location", validVerificationDateString(), AssuranceType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ Notary.verify(agent, applicant, applicant.getNames()[0], applicant.getDoB(), 5, "Test location", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
// add first Verification in the past result first name 95 VP
newAgent();
--- /dev/null
+package club.wpia.gigi.dbObjects;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import club.wpia.gigi.GigiApiException;
+import club.wpia.gigi.dbObjects.Country;
+import club.wpia.gigi.dbObjects.Name;
+import club.wpia.gigi.dbObjects.NamePart;
+import club.wpia.gigi.dbObjects.User;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
+import club.wpia.gigi.dbObjects.Country.CountryCodeType;
+import club.wpia.gigi.dbObjects.NamePart.NamePartType;
+import club.wpia.gigi.testUtils.ClientBusinessTest;
+import club.wpia.gigi.util.Notary;
+
+public class TestVerifyName extends ClientBusinessTest {
+
+ @Test
+ public void testIt() throws GigiApiException {
+ User u0 = User.getById(createVerificationUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
+ Name n2 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaa"));
+ Name n3 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaa"));
+ Name n4 = new Name(u, new NamePart(NamePartType.SINGLE_NAME, "Testiaac"));
+
+ assertEquals(0, n0.getVerificationPoints());
+ Notary.verify(u0, u, n0, u.getDoB(), 10, "test mgr", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ assertEquals(10, n0.getVerificationPoints());
+ Notary.verify(u0, u, n2, u.getDoB(), 10, "test mgr", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ assertEquals(10, n2.getVerificationPoints());
+ Notary.verify(u0, u, n3, u.getDoB(), 10, "test mgr", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ assertEquals(10, n3.getVerificationPoints());
+ Notary.verify(u0, u, n4, u.getDoB(), 10, "test mgr", validVerificationDateString(), VerificationType.FACE_TO_FACE, Country.getCountryByCode("DE", CountryCodeType.CODE_2_CHARS));
+ assertEquals(10, n4.getVerificationPoints());
+ assertEquals(10, u.getMaxVerifyPoints());
+ }
+}
public TestCertificateRequest() throws GeneralSecurityException, IOException, GigiApiException {
ac = new AuthorizationContext(u, u);
- makeAssurer(u.getId());
+ makeAgent(u.getId());
}
@Test
import club.wpia.gigi.dbObjects.User;
import club.wpia.gigi.pages.PasswordResetPage;
-import club.wpia.gigi.pages.wot.TestAssurance;
+import club.wpia.gigi.pages.wot.TestVerification;
import club.wpia.gigi.testUtils.ClientTest;
import club.wpia.gigi.testUtils.IOUtils;
import club.wpia.gigi.testUtils.TestEmailReceiver.TestMail;
public class TestPasswordResetExternal extends ClientTest {
@Test
- public void testByAssurance() throws IOException {
- User u = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.com", TEST_PASSWORD));
+ public void testByVerification() throws IOException {
+ User u = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.com", TEST_PASSWORD));
String cookie2 = login(u.getEmail(), TEST_PASSWORD);
- URLConnection uc = TestAssurance.buildupAssureFormConnection(cookie2, email, true);
+ URLConnection uc = TestVerification.buildupVerifyFormConnection(cookie2, email, true);
String avalue = RandomToken.generateToken(32);
- uc.getOutputStream().write(("assuredName=" + this.u.getPreferredName().getId() + "&date=" + TestAssurance.validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10&passwordReset=1&passwordResetValue=" + URLEncoder.encode(avalue, "UTF-8")).getBytes("UTF-8"));
+ uc.getOutputStream().write(("verifiedName=" + this.u.getPreferredName().getId() + "&date=" + TestVerification.validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10&passwordReset=1&passwordResetValue=" + URLEncoder.encode(avalue, "UTF-8")).getBytes("UTF-8"));
uc.getOutputStream().flush();
String error = fetchStartErrorMessage(IOUtils.readURL(uc));
assertNull(error);
@Test
public void testShow() throws IOException, GeneralSecurityException {
- CATS.enterResult(u, CATSType.ASSURER_CHALLENGE, new Date(System.currentTimeMillis()), "en_US", "1");
+ CATS.enterResult(u, CATSType.AGENT_CHALLENGE, new Date(System.currentTimeMillis()), "en_US", "1");
CATS.enterResult(u, "Special Case Test", new Date(System.currentTimeMillis()), "spLan", "v23");
String res = IOUtils.readURL(get(UserTrainings.PATH));
assertThat(res, containsString("Special Case Test"));
- assertThat(res, containsString(HTMLEncoder.encodeHTML(CATSType.ASSURER_CHALLENGE.getDisplayName())));
+ assertThat(res, containsString(HTMLEncoder.encodeHTML(CATSType.AGENT_CHALLENGE.getDisplayName())));
assertThat(res, containsString("en_US, 1"));
assertThat(res, containsString("v23"));
assertThat(res, containsString("spLan"));
// enter verification and open mypoints as supporter
- makeAssurer(this.id);
+ makeAgent(this.id);
String location = createUniqueName();
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
ps.setInt(1, this.id);
assertEquals("opname", orgs[0].getOptionalName());
assertEquals("postaladdress", orgs[0].getPostalAddress());
- User u2 = User.getById(createAssuranceUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ User u2 = User.getById(createVerificationUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
assertNull(executeBasicWebInteraction(cookie, ViewOrgPage.DEFAULT_PATH + "/" + orgs[0].getId(), "email=" + URLEncoder.encode(u2.getEmail(), "UTF-8") + "&do_affiliate=y&master=y", 1));
List<Affiliation> allAdmins = orgs[0].getAllAdmins();
assertEquals(1, allAdmins.size());
}
@Test
- public void testNonAssurerSeeOnlyOwn() throws IOException, GigiApiException {
- User u2 = User.getById(createAssuranceUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ public void testNonAgentSeeOnlyOwn() throws IOException, GigiApiException {
+ User u2 = User.getById(createVerificationUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
Organisation o1 = createUniqueOrg();
Organisation o2 = createUniqueOrg();
o1.addAdmin(u2, u, false);
@Test
public void testAffiliationRights() throws IOException, GigiApiException {
- User u2 = User.getById(createAssuranceUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
- User u3 = User.getById(createAssuranceUser("testmaster", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ User u2 = User.getById(createVerificationUser("testworker", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
+ User u3 = User.getById(createVerificationUser("testmaster", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
User u4_dummy = User.getById(createVerifiedUser("testmaster", "testname", createUniqueName() + "@testdom.com", TEST_PASSWORD));
Organisation o1 = createUniqueOrg();
o1.addAdmin(u3, u, true);
@Test
public void testTTPEnoughPoints() throws IOException, GigiApiException {
- User u = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ User u = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
cookie = login(u.getEmail(), TEST_PASSWORD);
String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
import club.wpia.gigi.dbObjects.Group;
import club.wpia.gigi.dbObjects.User;
import club.wpia.gigi.pages.account.MyDetails;
-import club.wpia.gigi.pages.wot.AssurePage;
-import club.wpia.gigi.pages.wot.Points;
import club.wpia.gigi.testUtils.IOUtils;
import club.wpia.gigi.testUtils.ManagedTest;
import club.wpia.gigi.testUtils.TestEmailReceiver.TestMail;
import club.wpia.gigi.util.DayDate;
import club.wpia.gigi.util.Notary;
-public class TestAssurance extends ManagedTest {
+public class TestVerification extends ManagedTest {
- private String assurerM;
+ private String agentM;
- private String assureeM;
+ private String applicantM;
- private int assureeName;
+ private int applicantName;
private String cookie;
@Before
public void setup() throws IOException {
clearCaches();
- assurerM = createUniqueName() + "@example.org";
- assureeM = createUniqueName() + "@example.org";
+ agentM = createUniqueName() + "@example.org";
+ applicantM = createUniqueName() + "@example.org";
- createAssuranceUser("a", "b", assurerM, TEST_PASSWORD);
- int assureeId = createVerifiedUser("a", "c", assureeM, TEST_PASSWORD);
- assureeName = User.getById(assureeId).getPreferredName().getId();
+ createVerificationUser("a", "b", agentM, TEST_PASSWORD);
+ int applicantId = createVerifiedUser("a", "c", applicantM, TEST_PASSWORD);
+ applicantName = User.getById(applicantId).getPreferredName().getId();
- cookie = login(assurerM, TEST_PASSWORD);
+ cookie = login(agentM, TEST_PASSWORD);
}
- private Matcher<String> isAssuranceForm() {
- return containsString("<select name=\"assuranceType\">");
+ private Matcher<String> isVerificationForm() {
+ return containsString("<select name=\"verificationType\">");
}
@Test
- public void testAssureSearch() throws IOException {
- String loc = search("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1910");
- assertThat(loc, isAssuranceForm());
+ public void testVerifySearch() throws IOException {
+ String loc = search("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=1&year=1910");
+ assertThat(loc, isVerificationForm());
}
@Test
- public void testAssureSearchEmail() throws IOException {
- String loc = search("email=1" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1910");
- assertThat(loc, not(isAssuranceForm()));
+ public void testVerifySearchEmail() throws IOException {
+ String loc = search("email=1" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=1&year=1910");
+ assertThat(loc, not(isVerificationForm()));
}
@Test
- public void testAssureSearchDobInvalid() throws IOException {
- String loc = search("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=mal");
- assertThat(loc, not(isAssuranceForm()));
+ public void testVerifySearchDobInvalid() throws IOException {
+ String loc = search("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=1&year=mal");
+ assertThat(loc, not(isVerificationForm()));
}
@Test
- public void testAssureSearchDob() throws IOException {
- String loc = search("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=2&month=1&year=1910");
- assertThat(loc, not(isAssuranceForm()));
- loc = search("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=2&year=1910");
- assertThat(loc, not(isAssuranceForm()));
- loc = search("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1911");
- assertThat(loc, not(isAssuranceForm()));
+ public void testVerifySearchDob() throws IOException {
+ String loc = search("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=2&month=1&year=1910");
+ assertThat(loc, not(isVerificationForm()));
+ loc = search("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=2&year=1910");
+ assertThat(loc, not(isVerificationForm()));
+ loc = search("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=1&year=1911");
+ assertThat(loc, not(isVerificationForm()));
}
private String search(String query) throws MalformedURLException, IOException, UnsupportedEncodingException {
- URLConnection uc = get(cookie, AssurePage.PATH);
+ URLConnection uc = get(cookie, VerifyPage.PATH);
uc.setDoOutput(true);
uc.getOutputStream().write(("search&" + query).getBytes("UTF-8"));
uc.getOutputStream().flush();
}
@Test
- public void testAssureForm() throws IOException {
+ public void testVerifyForm() throws IOException {
executeSuccess("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
}
@Test
- public void testAssureFormEmpty() throws IOException {
- URLConnection uc = buildupAssureFormConnection(true);
+ public void testVerifyFormEmpty() throws IOException {
+ URLConnection uc = buildupVerifyFormConnection(true);
uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&rules=1&assertion=1&points=10").getBytes("UTF-8"));
uc.getOutputStream().flush();
String data = IOUtils.readURL(uc);
}
@Test
- public void testAssureFormContanisData() throws IOException {
- URLConnection uc = buildupAssureFormConnection(true);
- uc.getOutputStream().write(("assuredName=" + assureeName + "&date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&rules=1&assertion=1&points=10").getBytes("UTF-8"));
+ public void testVerifyFormContainsData() throws IOException {
+ URLConnection uc = buildupVerifyFormConnection(true);
+ uc.getOutputStream().write(("verifiedName=" + applicantName + "&date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&rules=1&assertion=1&points=10").getBytes("UTF-8"));
uc.getOutputStream().flush();
String data = IOUtils.readURL(uc);
assertThat(data, containsString(validVerificationDateString()));
}
@Test
- public void testAssureFormNoCSRF() throws IOException {
+ public void testVerifyFormNoCSRF() throws IOException {
// override csrf
- HttpURLConnection uc = (HttpURLConnection) buildupAssureFormConnection(false);
+ HttpURLConnection uc = (HttpURLConnection) buildupVerifyFormConnection(false);
uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8"));
uc.getOutputStream().flush();
assertEquals(500, uc.getResponseCode());
}
@Test
- public void testAssureFormWrongCSRF() throws IOException {
+ public void testVerifyFormWrongCSRF() throws IOException {
// override csrf
- HttpURLConnection uc = (HttpURLConnection) buildupAssureFormConnection(false);
+ HttpURLConnection uc = (HttpURLConnection) buildupVerifyFormConnection(false);
uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10&csrf=aragc").getBytes("UTF-8"));
uc.getOutputStream().flush();
assertEquals(500, uc.getResponseCode());
}
@Test
- public void testAssureFormRaceDoB() throws IOException, SQLException {
- testAssureFormRace(false);
+ public void testVerifyFormRaceDoB() throws IOException, SQLException {
+ testVerifyFormRace(false);
}
@Test
- public void testAssureFormRaceDoBBlind() throws IOException, SQLException {
- testAssureFormRace(true);
+ public void testVerifyFormRaceDoBBlind() throws IOException, SQLException {
+ testVerifyFormRace(true);
}
- public void testAssureFormRace(boolean succeed) throws IOException, SQLException {
- URLConnection uc = buildupAssureFormConnection(true);
+ public void testVerifyFormRace(boolean succeed) throws IOException, SQLException {
+ URLConnection uc = buildupVerifyFormConnection(true);
- String assureeCookie = login(assureeM, TEST_PASSWORD);
+ String applicantCookie = login(applicantM, TEST_PASSWORD);
String newDob = "day=1&month=1&year=" + ( !succeed ? 1911 : 1910);
- assertNull(executeBasicWebInteraction(assureeCookie, MyDetails.PATH, newDob + "&action=updateDoB", 0));
+ assertNull(executeBasicWebInteraction(applicantCookie, MyDetails.PATH, newDob + "&action=updateDoB", 0));
- uc.getOutputStream().write(("assuredName=" + assureeName + "&date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8"));
+ uc.getOutputStream().write(("verifiedName=" + applicantName + "&date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8"));
uc.getOutputStream().flush();
String error = fetchStartErrorMessage(IOUtils.readURL(uc));
if (succeed) {
}
@Test
- public void testAssureFormFuture() throws IOException {
+ public void testVerifyFormFuture() throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
int year = Integer.parseInt(sdf.format(new Date(System.currentTimeMillis()))) + 2;
executeFails("date=" + year + "-01-01&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
}
@Test
- public void testAssureFormFutureOK() throws IOException {
+ public void testVerifyFormFutureOK() throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());
}
@Test
- public void testAssureFormPastInRange() throws IOException {
+ public void testVerifyFormPastInRange() throws IOException {
executeSuccess("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
}
@Test
- public void testAssureFormPastOnLimit() throws IOException {
+ public void testVerifyFormPastOnLimit() throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());
}
@Test
- public void testAssureFormPastOutOfRange() throws IOException {
+ public void testVerifyFormPastOutOfRange() throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());
}
@Test
- public void testAssureFormNoLoc() throws IOException {
+ public void testVerifyFormNoLoc() throws IOException {
executeFails("date=" + validVerificationDateString() + "&location=a&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
executeFails("date=" + validVerificationDateString() + "&location=&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
}
@Test
- public void testAssureFormInvalDate() throws IOException {
+ public void testVerifyFormInvalDate() throws IOException {
executeFails("date=20000101&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
executeFails("date=&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
}
@Test
- public void testAssureFormBoxes() throws IOException {
+ public void testVerifyFormBoxes() throws IOException {
executeFails("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=0&rules=1&assertion=1&points=10");
executeFails("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=&assertion=1&points=10");
executeFails("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=z&points=10");
}
@Test
- public void testAssureListingValid() throws IOException, GigiApiException {
+ public void testVerifyListingValid() throws IOException, GigiApiException {
String uniqueLoc = createUniqueName();
execute("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
- String cookie = login(assureeM, TEST_PASSWORD);
+ String cookie = login(applicantM, TEST_PASSWORD);
URLConnection url = get(cookie, Points.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[1];
}
@Test
- public void testAssurerListingValid() throws IOException, GigiApiException {
+ public void testAgentListingValid() throws IOException, GigiApiException {
String uniqueLoc = createUniqueName();
executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
- String cookie = login(assurerM, TEST_PASSWORD);
+ String cookie = login(agentM, TEST_PASSWORD);
URLConnection url = get(cookie, Points.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[2];
}
private String execute(String query) throws MalformedURLException, IOException {
- URLConnection uc = buildupAssureFormConnection(true);
- uc.getOutputStream().write(("assuredName=" + assureeName + "&" + query).getBytes("UTF-8"));
+ URLConnection uc = buildupVerifyFormConnection(true);
+ uc.getOutputStream().write(("verifiedName=" + applicantName + "&" + query).getBytes("UTF-8"));
uc.getOutputStream().flush();
return IOUtils.readURL(uc);
}
- private URLConnection buildupAssureFormConnection(boolean doCSRF) throws MalformedURLException, IOException {
- return buildupAssureFormConnection(cookie, assureeM, doCSRF);
+ private URLConnection buildupVerifyFormConnection(boolean doCSRF) throws MalformedURLException, IOException {
+ return buildupVerifyFormConnection(cookie, applicantM, doCSRF);
}
- public static URLConnection buildupAssureFormConnection(String cookie, String email, boolean doCSRF) throws MalformedURLException, IOException {
- URLConnection uc = get(cookie, AssurePage.PATH);
+ public static URLConnection buildupVerifyFormConnection(String cookie, String email, boolean doCSRF) throws MalformedURLException, IOException {
+ URLConnection uc = get(cookie, VerifyPage.PATH);
uc.setDoOutput(true);
uc.getOutputStream().write(("email=" + URLEncoder.encode(email, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes("UTF-8"));
String csrf = getCSRF(uc);
- uc = get(cookie, AssurePage.PATH);
+ uc = get(cookie, VerifyPage.PATH);
uc.setDoOutput(true);
if (doCSRF) {
uc.getOutputStream().write(("csrf=" + csrf + "&").getBytes("UTF-8"));
}
@Test
- public void testMultipleAssurance() throws IOException {
+ public void testMultipleVerification() throws IOException {
- User users[] = User.findByEmail(assurerM);
+ User users[] = User.findByEmail(agentM);
int agentID = users[0].getId();
- users = User.findByEmail(assureeM);
+ users = User.findByEmail(applicantM);
int applicantID = users[0].getId();
// enter first entry 200 days in the past
executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
// enter third entry on the same day
- URLConnection uc = get(cookie, AssurePage.PATH);
+ URLConnection uc = get(cookie, VerifyPage.PATH);
uc.setDoOutput(true);
- uc.getOutputStream().write(("email=" + URLEncoder.encode(assureeM, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes("UTF-8"));
+ uc.getOutputStream().write(("email=" + URLEncoder.encode(applicantM, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes("UTF-8"));
assertThat(IOUtils.readURL(uc), hasError());
}
@Test
- public void testAssureFormNoCountry() throws IOException {
+ public void testVerifyFormNoCountry() throws IOException {
executeFails("date=" + validVerificationDateString() + "&location=testcase&countryCode=&certify=1&rules=1&assertion=1&points=10");
}
public void testRANotificationSet() throws IOException, GigiApiException {
getMailReceiver().clearMails();
- User users[] = User.findByEmail(assurerM);
+ User users[] = User.findByEmail(agentM);
assertTrue("user RA Agent not found", users != null && users.length > 0);
User u = users[0];
u.grantGroup(u, Group.VERIFY_NOTIFICATION);
clearCaches();
- cookie = login(assurerM, TEST_PASSWORD);
+ cookie = login(agentM, TEST_PASSWORD);
String targetMail = u.getEmail();
do {
tm = getMailReceiver().receive();
} while ( !tm.getTo().equals(targetMail));
- assertThat(tm.getMessage(), containsString("You entered a verification for the account with email address " + assureeM));
+ assertThat(tm.getMessage(), containsString("You entered a verification for the account with email address " + applicantM));
}
public void testRANotificationNotSet() throws IOException, GigiApiException {
getMailReceiver().clearMails();
- User users[] = User.findByEmail(assurerM);
+ User users[] = User.findByEmail(agentM);
assertTrue("user RA Agent not found", users != null && users.length > 0);
User u = users[0];
u.revokeGroup(u, Group.VERIFY_NOTIFICATION);
clearCaches();
- cookie = login(assurerM, TEST_PASSWORD);
+ cookie = login(agentM, TEST_PASSWORD);
// enter verification
String uniqueLoc = createUniqueName();
TestMail tm;
tm = getMailReceiver().receive();
- assertThat(tm.getMessage(), not(containsString("You entered a verification for the account with email address " + assureeM)));
+ assertThat(tm.getMessage(), not(containsString("You entered a verification for the account with email address " + applicantM)));
}
}
return u;
}
- public static int createAssuranceUser(String f, String l, String mail, String pw) throws GigiApiException {
+ public static int createVerificationUser(String f, String l, String mail, String pw) throws GigiApiException {
int u = createVerifiedUser(f, l, mail, pw);
- makeAssurer(u);
+ makeAgent(u);
return u;
}
return i;
}
- public static void makeAssurer(int uid) {
+ public static void makeAgent(int uid) {
try (GigiPreparedStatement ps1 = new GigiPreparedStatement("INSERT INTO cats_passed SET user_id=?, variant_id=?, language='en_EN', version='1'")) {
ps1.setInt(1, uid);
- ps1.setInt(2, CATSType.ASSURER_CHALLENGE.getId());
+ ps1.setInt(2, CATSType.AGENT_CHALLENGE.getId());
ps1.execute();
}
* the password
* @return a new userid.
*/
- public static int createAssuranceUser(String firstName, String lastName, String email, String password) {
+ public static int createVerificationUser(String firstName, String lastName, String email, String password) {
int uid = createVerifiedUser(firstName, lastName, email, password);
- makeAssurer(uid);
+ makeAgent(uid);
return uid;
}
public class OrgTest extends ClientTest {
public OrgTest() throws IOException, GigiApiException {
- makeAssurer(u.getId());
+ makeAgent(u.getId());
u.grantGroup(getSupporter(), Group.ORGASSURER);
clearCaches();
cookie = login(email, TEST_PASSWORD);
protected static Organisation selfOrg;
public RestrictedApiTest() {
- makeAssurer(id);
+ makeAgent(id);
}
@BeforeClass
public static void initCert() {
initEnvironment();
try {
- User u = User.getById(createAssuranceUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
+ User u = User.getById(createVerificationUser("f", "l", createUniqueName() + "@email.com", TEST_PASSWORD));
grant(u, Group.ORGASSURER);
clearCaches();
u = User.getById(u.getId());
import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.database.GigiPreparedStatement;
import club.wpia.gigi.dbObjects.CATS;
+import club.wpia.gigi.dbObjects.CATS.CATSType;
import club.wpia.gigi.dbObjects.Country;
+import club.wpia.gigi.dbObjects.Country.CountryCodeType;
import club.wpia.gigi.dbObjects.Group;
import club.wpia.gigi.dbObjects.Name;
import club.wpia.gigi.dbObjects.NamePart;
+import club.wpia.gigi.dbObjects.NamePart.NamePartType;
import club.wpia.gigi.dbObjects.ObjectCache;
import club.wpia.gigi.dbObjects.User;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
-import club.wpia.gigi.dbObjects.CATS.CATSType;
-import club.wpia.gigi.dbObjects.Country.CountryCodeType;
-import club.wpia.gigi.dbObjects.NamePart.NamePartType;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.output.DateSelector;
import club.wpia.gigi.testUtils.BusinessTest;
-import club.wpia.gigi.util.Notary;
public class TestNotary extends BusinessTest {
public TestNotary() throws GigiApiException {}
@Test
- public void testNormalAssurance() throws SQLException, GigiApiException {
+ public void testNormalVerification() throws SQLException, GigiApiException {
User[] users = new User[30];
for (int i = 0; i < users.length; i++) {
int id = createVerifiedUser("fn" + i, "ln" + i, createUniqueName() + "@email.org", TEST_PASSWORD);
users[i] = User.getById(id);
}
- User assurer = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
+ User agent = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD));
int[] result = new int[] {
10, 10, 10, 10, 15, 15, 15, 15, 15, 20, 20, 20, 20, 20, 25, 25, 25, 25, 25, 30, 30, 30, 30, 30, 35, 35, 35, 35, 35, 35
};
try {
- Notary.assure(assurer, users[0], users[0].getPreferredName(), users[0].getDoB(), -1, "test-notary", validVerificationDateString(), AssuranceType.FACE_TO_FACE, DE);
+ Notary.verify(agent, users[0], users[0].getPreferredName(), users[0].getDoB(), -1, "test-notary", validVerificationDateString(), VerificationType.FACE_TO_FACE, DE);
fail("This shouldn't have passed");
} catch (GigiApiException e) {
// expected
}
for (int i = 0; i < result.length; i++) {
- assertEquals(result[i], assurer.getMaxAssurePoints());
+ assertEquals(result[i], agent.getMaxVerifyPoints());
- assuranceFail(assurer, users[i], result[i] + 1, "test-notary", validVerificationDateString());
- Notary.assure(assurer, users[i], users[i].getPreferredName(), users[i].getDoB(), result[i], "test-notary", validVerificationDateString(), AssuranceType.FACE_TO_FACE, DE);
- assuranceFail(assurer, users[i], result[i], "test-notary", validVerificationDateString());
+ verificationFail(agent, users[i], result[i] + 1, "test-notary", validVerificationDateString());
+ Notary.verify(agent, users[i], users[i].getPreferredName(), users[i].getDoB(), result[i], "test-notary", validVerificationDateString(), VerificationType.FACE_TO_FACE, DE);
+ verificationFail(agent, users[i], result[i], "test-notary", validVerificationDateString());
}
- assertEquals(35, assurer.getMaxAssurePoints());
+ assertEquals(35, agent.getMaxVerifyPoints());
- assertEquals(User.EXPERIENCE_POINTS + (30 * User.EXPERIENCE_POINTS), assurer.getExperiencePoints());
+ assertEquals(User.EXPERIENCE_POINTS + (30 * User.EXPERIENCE_POINTS), agent.getExperiencePoints());
}
- private void assuranceFail(User assurer, User user, int i, String location, String date) throws SQLException {
+ private void verificationFail(User agent, User applicant, int i, String location, String date) throws SQLException {
try {
- Notary.assure(assurer, user, user.getPreferredName(), user.getDoB(), i, location, date, AssuranceType.FACE_TO_FACE, DE);
+ Notary.verify(agent, applicant, applicant.getPreferredName(), applicant.getDoB(), i, location, date, VerificationType.FACE_TO_FACE, DE);
fail("This shouldn't have passed");
} catch (GigiApiException e) {
// expected
int id = createVerifiedUser("fn" + i, "ln" + i, createUniqueName() + "@email.org", TEST_PASSWORD);
users[i] = User.getById(id);
}
- int id = createAssuranceUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD);
+ int id = createVerificationUser("fn", "ln", createUniqueName() + "@email.org", TEST_PASSWORD);
try (GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `users` SET dob=NOW() - interval '15 years' WHERE id=?")) {
ps.setInt(1, id);
ps.execute();
}
ObjectCache.clearAllCaches(); // reload values from db
- User assurer = User.getById(id);
+ User agent = User.getById(id);
for (int i = 0; i < users.length; i++) {
- assuranceFail(assurer, users[i], -1, "test-notary", validVerificationDateString());
- assuranceFail(assurer, users[i], 11, "test-notary", validVerificationDateString());
+ verificationFail(agent, users[i], -1, "test-notary", validVerificationDateString());
+ verificationFail(agent, users[i], 11, "test-notary", validVerificationDateString());
if (User.POJAM_ENABLED) {
- Notary.assure(assurer, users[i], users[i].getPreferredName(), users[i].getDoB(), 10, "test-notary", validVerificationDateString(), AssuranceType.FACE_TO_FACE, DE);
+ Notary.verify(agent, users[i], users[i].getPreferredName(), users[i].getDoB(), 10, "test-notary", validVerificationDateString(), VerificationType.FACE_TO_FACE, DE);
}
- assuranceFail(assurer, users[i], 10, "test-notary", validVerificationDateString());
+ verificationFail(agent, users[i], 10, "test-notary", validVerificationDateString());
}
}
@Test
public void testFail() throws SQLException, GigiApiException {
- User assuranceUser = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- User assuree = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ User agent = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ User applicant = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
// invalid date format
- assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", "2014-01-blah");
+ verificationFail(agent, applicant, 10, "notary-junit-test", "2014-01-blah");
// empty date
- assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", "");
+ verificationFail(agent, applicant, 10, "notary-junit-test", "");
// null date
- assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", null);
+ verificationFail(agent, applicant, 10, "notary-junit-test", null);
// null location
- assuranceFail(assuranceUser, assuree, 10, null, validVerificationDateString());
+ verificationFail(agent, applicant, 10, null, validVerificationDateString());
// empty location
- assuranceFail(assuranceUser, assuree, 10, "", validVerificationDateString());
+ verificationFail(agent, applicant, 10, "", validVerificationDateString());
// date in the future
- assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", DateSelector.getDateFormat().format(new Date(System.currentTimeMillis() + 2 * 24 * 60 * 60 * 1000)));
+ verificationFail(agent, applicant, 10, "notary-junit-test", DateSelector.getDateFormat().format(new Date(System.currentTimeMillis() + 2 * 24 * 60 * 60 * 1000)));
// location too short
- assuranceFail(assuranceUser, assuree, 10, "n", validVerificationDateString());
+ verificationFail(agent, applicant, 10, "n", validVerificationDateString());
// points too low
- assuranceFail(assuranceUser, assuree, -1, "notary-junit-test", validVerificationDateString());
+ verificationFail(agent, applicant, -1, "notary-junit-test", validVerificationDateString());
// points too high
- assuranceFail(assuranceUser, assuree, 11, "notary-junit-test", validVerificationDateString());
+ verificationFail(agent, applicant, 11, "notary-junit-test", validVerificationDateString());
// verify oneself
- assuranceFail(assuranceUser, assuranceUser, 10, "notary-junit-test", validVerificationDateString());
- // not an assurer
- assuranceFail(assuree, assuranceUser, 10, "notary-junit-test", validVerificationDateString());
+ verificationFail(agent, agent, 10, "notary-junit-test", validVerificationDateString());
+ // not an agent
+ verificationFail(applicant, agent, 10, "notary-junit-test", validVerificationDateString());
// valid
- Notary.assure(assuranceUser, assuree, assuree.getPreferredName(), assuree.getDoB(), 10, "notary-junit-test", validVerificationDateString(), AssuranceType.FACE_TO_FACE, DE);
+ Notary.verify(agent, applicant, applicant.getPreferredName(), applicant.getDoB(), 10, "notary-junit-test", validVerificationDateString(), VerificationType.FACE_TO_FACE, DE);
// verify double
- assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", validVerificationDateString());
+ verificationFail(agent, applicant, 10, "notary-junit-test", validVerificationDateString());
}
@Test
public void testNucleus() throws SQLException, GigiApiException, IOException {
- User assuranceUser = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- assuranceUser.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
- User assuree = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- Name n1 = assuree.getPreferredName();
- Name n2 = new Name(assuree, new NamePart(NamePartType.FIRST_NAME, "F2"), new NamePart(NamePartType.LAST_NAME, "L2"));
-
- assertEquals(0, assuree.getExperiencePoints());
- assertEquals(User.EXPERIENCE_POINTS, assuranceUser.getExperiencePoints());
- assertEquals(0, assuree.getAssurancePoints());
- assertEquals(0, n2.getAssurancePoints());
- Notary.assureAll(assuranceUser, assuree, assuree.getDoB(), 50, "notary-junit-test", validVerificationDateString(), AssuranceType.NUCLEUS, new Name[] {
+ User agent = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ agent.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
+ User applicant = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ Name n1 = applicant.getPreferredName();
+ Name n2 = new Name(applicant, new NamePart(NamePartType.FIRST_NAME, "F2"), new NamePart(NamePartType.LAST_NAME, "L2"));
+
+ assertEquals(0, applicant.getExperiencePoints());
+ assertEquals(User.EXPERIENCE_POINTS, agent.getExperiencePoints());
+ assertEquals(0, applicant.getVerificationPoints());
+ assertEquals(0, n2.getVerificationPoints());
+ Notary.verifyAll(agent, applicant, applicant.getDoB(), 50, "notary-junit-test", validVerificationDateString(), VerificationType.NUCLEUS, new Name[] {
n1, n2
}, DE);
- assertEquals(0, assuree.getExperiencePoints());
- assertEquals(2 * User.EXPERIENCE_POINTS, assuranceUser.getExperiencePoints());
- assertEquals(50, assuree.getAssurancePoints());
- assertEquals(50, n1.getAssurancePoints());
- assertEquals(50, n2.getAssurancePoints());
+ assertEquals(0, applicant.getExperiencePoints());
+ assertEquals(2 * User.EXPERIENCE_POINTS, agent.getExperiencePoints());
+ assertEquals(50, applicant.getVerificationPoints());
+ assertEquals(50, n1.getVerificationPoints());
+ assertEquals(50, n2.getVerificationPoints());
}
@Test
public void testNucleusProcess() throws SQLException, GigiApiException, IOException {
- User assuranceUser = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- assuranceUser.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
- User assuranceUser2 = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- assuranceUser2.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
- User assuree = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
- Notary.assure(assuranceUser, assuree, assuree.getPreferredName(), assuree.getDoB(), 50, "test", validVerificationDateString(), AssuranceType.NUCLEUS, DE);
- Notary.assure(assuranceUser2, assuree, assuree.getPreferredName(), assuree.getDoB(), 50, "test", validVerificationDateString(), AssuranceType.NUCLEUS, DE);
-
- assertEquals(100, assuree.getAssurancePoints());
- assertFalse(assuree.canAssure());
- CATS.enterResult(assuree, CATSType.ASSURER_CHALLENGE, new Date(), "de", "1");
- assertTrue(assuree.canAssure());
+ User agent1 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ agent1.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
+ User agent2 = User.getById(createVerificationUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ agent2.grantGroup(getSupporter(), Group.NUCLEUS_ASSURER);
+ User applicant = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ Notary.verify(agent1, applicant, applicant.getPreferredName(), applicant.getDoB(), 50, "test", validVerificationDateString(), VerificationType.NUCLEUS, DE);
+ Notary.verify(agent2, applicant, applicant.getPreferredName(), applicant.getDoB(), 50, "test", validVerificationDateString(), VerificationType.NUCLEUS, DE);
+
+ assertEquals(100, applicant.getVerificationPoints());
+ assertFalse(applicant.canVerify());
+ CATS.enterResult(applicant, CATSType.AGENT_CHALLENGE, new Date(), "de", "1");
+ assertTrue(applicant.canVerify());
}
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import sun.security.x509.X509Key;
import club.wpia.gigi.Gigi;
import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.crypto.SPKAC;
import club.wpia.gigi.database.GigiPreparedStatement;
-import club.wpia.gigi.dbObjects.Assurance.AssuranceType;
import club.wpia.gigi.dbObjects.CATS;
import club.wpia.gigi.dbObjects.CATS.CATSType;
import club.wpia.gigi.dbObjects.Certificate;
import club.wpia.gigi.dbObjects.NamePart;
import club.wpia.gigi.dbObjects.NamePart.NamePartType;
import club.wpia.gigi.dbObjects.User;
+import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.email.DelegateMailProvider;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.template.IterableDataset;
import club.wpia.gigi.util.HTMLEncoder;
import club.wpia.gigi.util.Notary;
import club.wpia.gigi.util.TimeConditions;
+import sun.security.x509.X509Key;
public class Manager extends Page {
return supporter;
}
try {
- User u = createAssurer( -1);
+ User u = createAgent( -1);
if ( !u.isInGroup(Group.SUPPORTER)) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `user_groups` SET `user`=?, `permission`=?::`userGroup`, `grantedby`=?")) {
ps.setInt(1, u.getId());
return supporter;
}
- public User getAssurer(int i) {
- if (assurers[i] != null) {
- return assurers[i];
+ public User getAgent(int i) {
+ if (agents[i] != null) {
+ return agents[i];
}
try {
- User u = createAssurer(i);
- assurers[i] = u;
+ User u = createAgent(i);
+ agents[i] = u;
} catch (ReflectiveOperationException | GigiApiException e) {
e.printStackTrace();
}
- return assurers[i];
+ return agents[i];
}
- private User createAssurer(int i) throws GigiApiException, IllegalAccessException {
+ private User createAgent(int i) throws GigiApiException, IllegalAccessException {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `country`=?")) {
- String mail = "test-assurer" + i + "@example.com";
+ String mail = "test-agent" + i + "@example.com";
User u = User.getByEmail(mail);
if (u == null) {
System.out.println("Creating RA-Agent");
createUser(mail);
u = User.getByEmail(mail);
- passCATS(u, CATSType.ASSURER_CHALLENGE);
+ passCATS(u, CATSType.AGENT_CHALLENGE);
ps.setInt(1, u.getId());
ps.setInt(2, u.getPreferredName().getId());
ps.setInt(3, 100);
// ea.verify(hash);
}
- User[] assurers = new User[25];
+ User[] agents = new User[25];
User supporter;
CATSType test = CATSType.values()[Integer.parseInt(testId)];
passCATS(byEmail, test);
resp.getWriter().println("Test '" + test.getDisplayName() + "' was added to user account.");
- } else if (req.getParameter("assure") != null) {
- String mail = req.getParameter("assureEmail");
+ } else if (req.getParameter("verify") != null) {
+ String mail = req.getParameter("verifyEmail");
String verificationPoints = req.getParameter("verificationPoints");
User byEmail = User.getByEmail(mail);
if (vp < 10) {
currentVP = vp;
}
- Notary.assure(getAssurer(agentNumber), byEmail, byEmail.getPreferredName(), byEmail.getDoB(), currentVP, "Testmanager Verify up code", validVerificationDateString(), AssuranceType.FACE_TO_FACE, getRandomCountry());
+ Notary.verify(getAgent(agentNumber), byEmail, byEmail.getPreferredName(), byEmail.getDoB(), currentVP, "Testmanager Verify up code", validVerificationDateString(), VerificationType.FACE_TO_FACE, getRandomCountry());
agentNumber += 1;
vp -= currentVP;
}
throw new Error(e);
}
- resp.getWriter().println("User has been assured " + agentNumber + " times.");
+ resp.getWriter().println("User has been verified " + agentNumber + " times.");
- } else if (req.getParameter("letassure") != null) {
- String mail = req.getParameter("letassureEmail");
+ } else if (req.getParameter("letverify") != null) {
+ String mail = req.getParameter("letverifyEmail");
User byEmail = User.getByEmail(mail);
try {
for (int i = 0; i < 25; i++) {
- User a = getAssurer(i);
- Notary.assure(byEmail, a, a.getNames()[0], a.getDoB(), 10, "Testmanager exp up code", validVerificationDateString(), AssuranceType.FACE_TO_FACE, getRandomCountry());
+ User a = getAgent(i);
+ Notary.verify(byEmail, a, a.getNames()[0], a.getDoB(), 10, "Testmanager exp up code", validVerificationDateString(), VerificationType.FACE_TO_FACE, getRandomCountry());
}
} catch (GigiApiException e) {
throw new Error(e);
<tr><td>
Add 100 Verification Points:
</td><td>
-Email: <input type="text" name="assureEmail"/>
+Email: <input type="text" name="verifyEmail"/>
</td><td>
Verification Points to issue to preferred name: </br>
-<input type="text" name="verificationPoints" value="100"/> <input type="submit" value="Add Points" name="assure"/>
+<input type="text" name="verificationPoints" value="100"/> <input type="submit" value="Add Points" name="verify"/>
</td></tr>
<tr><td>
Verify 25 others (get 25 Experience Points) :
</td><td>
-Email: <input type="text" name="letassureEmail"/>
+Email: <input type="text" name="letverifyEmail"/>
</td><td>
-<input type="submit" value="Add 25 Experience Points" name="letassure"/>
+<input type="submit" value="Add 25 Experience Points" name="letverify"/>
</td></tr>
<tr><td>