]> WPIA git - gigi.git/commitdiff
upd: remove alert settings from register process
authorINOPIAE <m.maengel@inopiae.de>
Thu, 7 Dec 2017 05:29:09 +0000 (06:29 +0100)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Fri, 22 Dec 2017 23:17:40 +0000 (00:17 +0100)
Change-Id: I511ceed2f00c15902c46d31564ba4f8454fef774

src/club/wpia/gigi/database/DatabaseConnection.java
src/club/wpia/gigi/database/tableStructure.sql
src/club/wpia/gigi/database/upgrade/from_35.sql [new file with mode: 0644]
src/club/wpia/gigi/pages/main/Signup.java
src/club/wpia/gigi/pages/main/Signup.templ
tests/club/wpia/gigi/pages/main/RegisterPageTest.java

index 40eeae69f02426feab1b385124d4740b611ffc24..04351d1a38e8ab2af427c6f3c1473a5dfcac322a 100644 (file)
@@ -181,7 +181,7 @@ public class DatabaseConnection {
 
     }
 
 
     }
 
-    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;
 
 
     public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
 
index 82aedc72a9b0e02c919e11678b7f61a92b4f6e97..8c697f78a93376352554274e245d03e40adbe21d 100644 (file)
@@ -115,16 +115,6 @@ CREATE TABLE "baddomains" (
 );
 
 
 );
 
 
-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,
 DROP TABLE IF EXISTS "user_agreements";
 CREATE TABLE "user_agreements" (
   "id" serial NOT NULL,
@@ -380,7 +370,7 @@ CREATE TABLE "schemeVersion" (
   "version" smallint NOT NULL,
   PRIMARY KEY ("version")
 );
   "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` (
 
 DROP TABLE IF EXISTS `passwordResetTickets`;
 CREATE TABLE `passwordResetTickets` (
diff --git a/src/club/wpia/gigi/database/upgrade/from_35.sql b/src/club/wpia/gigi/database/upgrade/from_35.sql
new file mode 100644 (file)
index 0000000..53dcc4d
--- /dev/null
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS "alerts";
index c5dcadf75c48585cf2912b5b6a00296befc8e690..d9b2cc1f8de65fc0744c023a72e555fa370062cb 100644 (file)
@@ -37,8 +37,6 @@ public class Signup extends Form {
 
     private static final Template t = new Template(Signup.class.getResource("Signup.templ"));
 
 
     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) {
     private CountrySelector cs;
 
     public Signup(HttpServletRequest hsr) {
@@ -55,10 +53,6 @@ public class Signup extends Form {
         vars.put("name", ni);
         vars.put("dob", myDoB);
         vars.put("email", HTMLEncoder.encodeHTML(email));
         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 + "");
         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 + "");
@@ -70,10 +64,6 @@ public class Signup extends Form {
         if (r.getParameter("email") != null) {
             email = r.getParameter("email");
         }
         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);
         GigiApiException problems = new GigiApiException();
         try {
             ni.update(r);
@@ -190,15 +180,6 @@ public class Signup extends Form {
 
     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());
 
     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);
     }
 
         Notary.writeUserAgreement(u, "ToS", "account creation", "", true, 0);
     }
 
index d241a8634b02110bcd4e7770605a10a394d43cdf..bc602e78cd97997c2854da1944b502af9f13332c 100644 (file)
   <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"><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>
 
   <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>&nbsp;</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>
 
   <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>
 
   <tr>
     <td colspan="3"><input class="btn btn-primary" type="submit" name="process" value="<?=_Next?>"></td>
index d9de3a910d1095f4999fd023687f3dbd80902c0b..85e34b92e97072220d3cf12560f850a140dc9e56 100644 (file)
@@ -49,14 +49,14 @@ public class RegisterPageTest extends ManagedTest {
 
         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 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&regional=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"));
         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&regional=1&radius=1";
+        query = defaultSignup + URLEncoder.encode("correct4_" + uniq + "@email.de", "UTF-8");
         data = fetchStartErrorMessage(runRegister(query));
         assertNotNull(data);
 
         data = fetchStartErrorMessage(runRegister(query));
         assertNotNull(data);
 
@@ -170,20 +170,6 @@ public class RegisterPageTest extends ManagedTest {
         assertThat(run, containsString("<option selected=\"selected\">28</option>"));
     }
 
         assertThat(run, containsString("<option selected=\"selected\">28</option>"));
     }
 
-    @Test
-    public void testCheckboxesStay() throws IOException {
-        String run2 = runRegister("general=1&country=a&regional=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();
     @Test
     public void testDoubleMail() throws IOException {
         long uniq = System.currentTimeMillis();
@@ -221,7 +207,7 @@ public class RegisterPageTest extends ManagedTest {
 
         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 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&regional=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 data = fetchStartErrorMessage(runRegister(query));
         assertNull(data);
         User u = User.getByEmail(email);
@@ -236,7 +222,7 @@ public class RegisterPageTest extends ManagedTest {
 
         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 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&regional=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);
         String data = fetchStartErrorMessage(runRegister(query));
         assertNull(data);
         User u = User.getByEmail(email);