}
- public static final int CURRENT_SCHEMA_VERSION = 35;
+ public static final int CURRENT_SCHEMA_VERSION = 36;
public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
);
-DROP TABLE IF EXISTS "alerts";
-CREATE TABLE "alerts" (
- "memid" int NOT NULL DEFAULT '0',
- "general" boolean NOT NULL DEFAULT 'false',
- "country" boolean NOT NULL DEFAULT 'false',
- "regional" boolean NOT NULL DEFAULT 'false',
- "radius" boolean NOT NULL DEFAULT 'false',
- PRIMARY KEY ("memid")
-);
-
DROP TABLE IF EXISTS "user_agreements";
CREATE TABLE "user_agreements" (
"id" serial NOT NULL,
"version" smallint NOT NULL,
PRIMARY KEY ("version")
);
-INSERT INTO "schemeVersion" (version) VALUES(35);
+INSERT INTO "schemeVersion" (version) VALUES(36);
DROP TABLE IF EXISTS `passwordResetTickets`;
CREATE TABLE `passwordResetTickets` (
--- /dev/null
+DROP TABLE IF EXISTS "alerts";
private static final Template t = new Template(Signup.class.getResource("Signup.templ"));
- private boolean general = true, country = true, regional = true, radius = true;
-
private CountrySelector cs;
public Signup(HttpServletRequest hsr) {
vars.put("name", ni);
vars.put("dob", myDoB);
vars.put("email", HTMLEncoder.encodeHTML(email));
- vars.put("general", general ? " checked=\"checked\"" : "");
- vars.put("country", country ? " checked=\"checked\"" : "");
- vars.put("regional", regional ? " checked=\"checked\"" : "");
- vars.put("radius", radius ? " checked=\"checked\"" : "");
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 + "");
if (r.getParameter("email") != null) {
email = r.getParameter("email");
}
- general = "1".equals(r.getParameter("general"));
- country = "1".equals(r.getParameter("country"));
- regional = "1".equals(r.getParameter("regional"));
- radius = "1".equals(r.getParameter("radius"));
GigiApiException problems = new GigiApiException();
try {
ni.update(r);
private void run(HttpServletRequest req, String password) throws GigiApiException {
User u = new User(email, password, myDoB.getDate(), Page.getLanguage(req).getLocale(), cs.getCountry(), ni.getNameParts());
-
- try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `alerts` SET `memid`=?," + " `general`=?, `country`=?, `regional`=?, `radius`=?")) {
- ps.setInt(1, u.getId());
- ps.setBoolean(2, general);
- ps.setBoolean(3, country);
- ps.setBoolean(4, regional);
- ps.setBoolean(5, radius);
- ps.execute();
- }
Notary.writeUserAgreement(u, "ToS", "account creation", "", true, 0);
}
<tr>
<td colspan="3"><font color="red">*</font><?=_Your password is one of many factors to protect your account from unauthorised access. A good password is hard to guess, long, and contains a diverse set of characters. For the current requirements and to learn more, visit our !(/wiki/goodPassword)FAQ!'</a>'.?></td>
</tr>
- <tr>
- <td colspan="3"><?=_It's possible to get notifications of up and coming events and even just general announcements, untick any notifications you don't wish to receive. For country, regional and radius notifications to work you must choose your location once you've verified your account and logged in.?></td>
- </tr>
<tr>
- <td valign="top"><?=_Alert me if?>: </td>
- <td align="left">
- <input type="checkbox" name="general" value="1"<?=$!general?>><?=_General Announcements?><br>
- <input type="checkbox" name="country" value="1"<?=$!country?>><?=_Country Announcements?><br>
- <input type="checkbox" name="regional" value="1"<?=$!regional?>><?=_Regional Announcements?><br>
- <input type="checkbox" name="radius" value="1"<?=$!radius?>><?=_Within 200km Announcements?></td>
- <td> </td>
+ <td colspan="3"><input type="checkbox" name="tos_agree" value="1"><?=_I agree to the Terms of Service (!(/policy/ToS)ToS!'</a>').?></td>
</tr>
<tr>
<td colspan="3"><?=_When you click on next, we will send a confirmation email to the email address you have entered above.?></td>
</tr>
- <tr>
- <td colspan="3"><input type="checkbox" name="tos_agree" value="1"><?=_I agree to the Terms of Service (!(/policy/ToS)ToS!'</a>').?></td>
- </tr>
<tr>
<td colspan="3"><input class="btn btn-primary" type="submit" name="process" value="<?=_Next?>"></td>
String defaultSignup = "fname=" + URLEncoder.encode("ab", "UTF-8") + "&lname=" + URLEncoder.encode("b", "UTF-8") + "&pword1=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&pword2=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&day=1&month=1&year=1910&tos_agree=1&mname=mn&suffix=sf&email=";
- String query = defaultSignup + URLEncoder.encode("correct3_" + uniq + "@email.de", "UTF-8") + "&general=1&country=1®ional=1&radius=1&name-type=western";
+ String query = defaultSignup + URLEncoder.encode("correct3_" + uniq + "@email.de", "UTF-8") + "&name-type=western";
String data = fetchStartErrorMessage(runRegister(query));
assertNull(data);
assertSuccessfullRegMail("correct3_" + uniq + "@email.de");
getMailReceiver().setEmailCheckError("400 Greylisted");
getMailReceiver().setApproveRegex(Pattern.compile("a"));
- query = defaultSignup + URLEncoder.encode("correct4_" + uniq + "@email.de", "UTF-8") + "&general=1&country=1®ional=1&radius=1";
+ query = defaultSignup + URLEncoder.encode("correct4_" + uniq + "@email.de", "UTF-8");
data = fetchStartErrorMessage(runRegister(query));
assertNotNull(data);
assertThat(run, containsString("<option selected=\"selected\">28</option>"));
}
- @Test
- public void testCheckboxesStay() throws IOException {
- String run2 = runRegister("general=1&country=a®ional=1&radius=0");
- assertThat(run2, containsString("name=\"general\" value=\"1\" checked=\"checked\">"));
- assertThat(run2, containsString("name=\"country\" value=\"1\">"));
- assertThat(run2, containsString("name=\"regional\" value=\"1\" checked=\"checked\">"));
- assertThat(run2, containsString("name=\"radius\" value=\"1\">"));
- run2 = runRegister("general=0&country=1&radius=1");
- assertThat(run2, containsString("name=\"general\" value=\"1\">"));
- assertThat(run2, containsString("name=\"country\" value=\"1\" checked=\"checked\">"));
- assertThat(run2, containsString("name=\"regional\" value=\"1\">"));
- assertThat(run2, containsString("name=\"radius\" value=\"1\" checked=\"checked\">"));
- }
-
@Test
public void testDoubleMail() throws IOException {
long uniq = System.currentTimeMillis();
String defaultSignup = "fname=" + URLEncoder.encode("ab", "UTF-8") + "&lname=" + URLEncoder.encode("b", "UTF-8") + "&pword1=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&pword2=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&day=1&month=1&year=1910&tos_agree=1&mname=mn&suffix=sf&email=";
- String query = defaultSignup + URLEncoder.encode(email, "UTF-8") + "&general=1&country=1®ional=1&radius=1&name-type=western&residenceCountry=DE";
+ String query = defaultSignup + URLEncoder.encode(email, "UTF-8") + "&name-type=western&residenceCountry=DE";
String data = fetchStartErrorMessage(runRegister(query));
assertNull(data);
User u = User.getByEmail(email);
String defaultSignup = "fname=" + URLEncoder.encode("ab", "UTF-8") + "&lname=" + URLEncoder.encode("b", "UTF-8") + "&pword1=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&pword2=" + URLEncoder.encode(TEST_PASSWORD, "UTF-8") + "&day=1&month=1&year=1910&tos_agree=1&mname=mn&suffix=sf&email=";
- String query = defaultSignup + URLEncoder.encode(email, "UTF-8") + "&general=1&country=1®ional=1&radius=1&name-type=western&residenceCountry=invalid";
+ String query = defaultSignup + URLEncoder.encode(email, "UTF-8") + "&name-type=western&residenceCountry=invalid";
String data = fetchStartErrorMessage(runRegister(query));
assertNull(data);
User u = User.getByEmail(email);