- TestMail tm = ter.recieve();
- String verifyLink = tm.extractLink();
- String[] parts = verifyLink.split("\\?");
- URL u = new URL("https://" + getServerName() + "/verify?" + parts[1]);
- u.openStream().close();
-
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id FROM users where email=?");
- ps.setString(1, email);
- GigiResultSet rs = ps.executeQuery();
- if (rs.next()) {
- return rs.getInt(1);
+ ter.receive().verify();
+
+ try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT `id` FROM `users` WHERE `email`=?")) {
+ ps.setString(1, email);
+
+ GigiResultSet rs = ps.executeQuery();
+ if (rs.next()) {
+ return rs.getInt(1);
+ }