X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FUser.java;h=61f347a4e90b380e70802d9871641da1ead0161f;hp=e5175694ed1b8ac1083ad728de76740a283d4cc9;hb=dff3996afcd54cde9dfed259a9a24ceecaa78e7a;hpb=35e69fce891287dddc156b674e9a298a148bca4c diff --git a/src/org/cacert/gigi/dbObjects/User.java b/src/org/cacert/gigi/dbObjects/User.java index e5175694..61f347a4 100644 --- a/src/org/cacert/gigi/dbObjects/User.java +++ b/src/org/cacert/gigi/dbObjects/User.java @@ -43,13 +43,15 @@ public class User extends CertificateOwner { public static final int MINIMUM_AGE = 16; + public static final int MAXIMUM_PLAUSIBLE_AGE = 120; + public static final int POJAM_AGE = 14; public static final int ADULT_AGE = 18; public static final boolean POJAM_ENABLED = false; - public static final int EXPERIENCE_POINTS = 2; + public static final int EXPERIENCE_POINTS = 4; /** * Time in months a verification is considered "recent". @@ -136,6 +138,14 @@ public class User extends CertificateOwner { if (getReceivedAssurances().length != 0) { throw new GigiApiException("No change after assurance allowed."); } + + if ( !CalendarUtil.isOfAge(dob, User.MINIMUM_AGE)) { + throw new GigiApiException("Entered date of birth is below the restricted age requirements."); + } + + if (CalendarUtil.isOfAge(dob, User.MAXIMUM_PLAUSIBLE_AGE)) { + throw new GigiApiException("Entered date of birth exceeds the maximum age set in our policies. Please check your DoB is correct and contact support if the issue persists."); + } this.dob = dob; rawUpdateUserData(); } @@ -247,6 +257,7 @@ public class User extends CertificateOwner { * * @return the maximal points @ */ + @SuppressWarnings("unused") public int getMaxAssurePoints() { if ( !CalendarUtil.isOfAge(dob, ADULT_AGE) && POJAM_ENABLED) { return 10; // PoJAM @@ -385,7 +396,7 @@ public class User extends CertificateOwner { } - public Name getPreferredName() { + public synchronized Name getPreferredName() { return preferredName; }