- outputError(out, req, "The Pass Phrase you submitted failed to contain enough" + " differing characters and/or contained words from" + " your name and/or email address.");
- }
- if (isFailed(out)) {
- return false;
- }
- GigiPreparedStatement q1 = DatabaseConnection.getInstance().prepare("SELECT * FROM `emails` WHERE `email`=? AND `deleted` IS NULL");
- GigiPreparedStatement q2 = DatabaseConnection.getInstance().prepare("SELECT * FROM `certOwners` INNER JOIN `users` ON `users`.`id`=`certOwners`.`id` WHERE `email`=? AND `deleted` IS NULL");
- q1.setString(1, email);
- q2.setString(1, email);
- GigiResultSet r1 = q1.executeQuery();
- GigiResultSet r2 = q2.executeQuery();
- if (r1.next() || r2.next()) {
- outputError(out, req, "This email address is currently valid in the system.");
- }
- r1.close();
- r2.close();
- GigiPreparedStatement q3 = DatabaseConnection.getInstance().prepare("SELECT `domain` FROM `baddomains` WHERE `domain`=RIGHT(?, LENGTH(`domain`))");
- q3.setString(1, email);
-
- GigiResultSet r3 = q3.executeQuery();
- if (r3.next()) {
- String domain = r3.getString(1);
- outputError(out, req, "We don't allow signups from people using email addresses from %s", domain);
- }
- r3.close();
+ ga.mergeInto(new GigiApiException("The Pass Phrase you submitted failed to contain enough" + " differing characters and/or contained words from" + " your name and/or email address."));
+ }
+ if ( !ga.isEmpty()) {
+ throw ga;
+ }
+ GigiApiException ga2 = new GigiApiException();
+ try (GigiPreparedStatement q1 = new GigiPreparedStatement("SELECT * FROM `emails` WHERE `email`=? AND `deleted` IS NULL"); GigiPreparedStatement q2 = new GigiPreparedStatement("SELECT * FROM `certOwners` INNER JOIN `users` ON `users`.`id`=`certOwners`.`id` WHERE `email`=? AND `deleted` IS NULL")) {
+ q1.setString(1, email);
+ q2.setString(1, email);
+ GigiResultSet r1 = q1.executeQuery();
+ GigiResultSet r2 = q2.executeQuery();
+ if (r1.next() || r2.next()) {
+ ga2.mergeInto(new GigiApiException("This email address is currently valid in the system."));
+ }
+ }
+ try (GigiPreparedStatement q3 = new GigiPreparedStatement("SELECT `domain` FROM `baddomains` WHERE `domain`=RIGHT(?, LENGTH(`domain`))")) {
+ q3.setString(1, email);
+
+ GigiResultSet r3 = q3.executeQuery();
+ if (r3.next()) {
+ String domain = r3.getString(1);
+ ga2.mergeInto(new GigiApiException(SprintfCommand.createSimple("We don't allow signups from people using email addresses from {0}.", domain)));
+ }
+ }