]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/pages/main/Signup.java
fix: correct validation of minimum and maximum ages
[gigi.git] / src / club / wpia / gigi / pages / main / Signup.java
index 134df159bc13d9db8b479b89dadea7cba17c8a4b..746fd803a6bee2790cd6f37c2ac4070ee8a47fde 100644 (file)
@@ -2,6 +2,7 @@ package club.wpia.gigi.pages.main;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -50,7 +51,7 @@ public class Signup extends Form {
 
     @Override
     public void outputContent(PrintWriter out, Language l, Map<String, Object> outerVars) {
-        HashMap<String, Object> vars = new HashMap<String, Object>();
+        HashMap<String, Object> vars = new HashMap<String, Object>(outerVars);
         vars.put("name", ni);
         vars.put("dob", myDoB);
         vars.put("email", HTMLEncoder.encodeHTML(email));
@@ -58,7 +59,7 @@ public class Signup extends Form {
         vars.put("country", country ? " checked=\"checked\"" : "");
         vars.put("regional", regional ? " checked=\"checked\"" : "");
         vars.put("radius", radius ? " checked=\"checked\"" : "");
-        vars.put("helpOnNames", String.format(l.getTranslation("Help on Names %sin the wiki%s"), "<a href=\"#\" target=\"_blank\">", "</a>"));
+        vars.put("helpOnNames", new SprintfCommand("Help on Names {0}in the wiki{1}", Arrays.asList("!(/wiki/names", "!'</a>")));
         vars.put("csrf", getCSRFToken());
         vars.put("dobmin", User.MINIMUM_AGE + "");
         vars.put("countryCode", cs);
@@ -119,7 +120,7 @@ public class Signup extends Form {
             ga.mergeInto(new GigiApiException("Entered date of birth is below the restricted age requirements."));
         }
 
-        if (CalendarUtil.isOfAge(myDoB.getDate(), User.MAXIMUM_PLAUSIBLE_AGE)) {
+        if (CalendarUtil.isYearsInFuture(myDoB.getDate().end(), User.MAXIMUM_PLAUSIBLE_AGE)) {
             ga.mergeInto(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."));
         }