- @Override
- public synchronized boolean submit(PrintWriter out, HttpServletRequest req) {
- update(req);
- boolean failed = false;
- out.println("<div class='formError'>");
- if (buildup.getFname().equals("") || buildup.getLname().equals("")) {
- outputError(out, req, "First and/or last names were blank.");
- failed = true;
- }
- if (!myDoB.isValid()) {
- outputError(out, req, "Invalid date of birth");
- failed = true;
- }
- if (!"1".equals(req.getParameter("cca_agree"))) {
- outputError(out, req, "You have to agree to the CAcert Community agreement.");
- failed = true;
- }
- if (buildup.getEmail().equals("")) {
- outputError(out, req, "Email Address was blank");
- failed = true;
- }
- String pw1 = req.getParameter("pword1");
- String pw2 = req.getParameter("pword2");
- if (pw1 == null || pw1.equals("")) {
- outputError(out, req, "Pass Phrases were blank");
- failed = true;
- } else if (!pw1.equals(pw2)) {
- outputError(out, req, "Pass Phrases don't match");
- failed = true;
- }
- int pwpoints = PasswordStrengthChecker.checkpw(pw1, buildup);
- if (pwpoints < 3) {
- 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.");
- failed = true;
- }
- if (failed) {
- out.println("</div>");
- return false;
- }
- try {
- PreparedStatement q1 = DatabaseConnection.getInstance().prepare(
- "select * from `email` where `email`=? and `deleted`=0");
- PreparedStatement q2 = DatabaseConnection.getInstance().prepare(
- "select * from `users` where `email`=? and `deleted`=0");
- q1.setString(1, buildup.getEmail());
- q2.setString(1, buildup.getEmail());
- ResultSet r1 = q1.executeQuery();
- ResultSet r2 = q2.executeQuery();
- if (r1.next() || r2.next()) {
- outputError(out, req, "This email address is currently valid in the system.");
- failed = true;
- }
- r1.close();
- r2.close();
- PreparedStatement q3 = DatabaseConnection.getInstance().prepare(
- "select `domain` from `baddomains` where `domain`=RIGHT(?, LENGTH(`domain`))");
- q3.setString(1, buildup.getEmail());
+ @Override
+ public synchronized boolean submit(PrintWriter out, HttpServletRequest req) {
+ update(req);
+ if (buildup.getLname().trim().equals("")) {
+ outputError(out, req, "Last name were blank.");
+ }
+ if ( !myDoB.isValid()) {
+ outputError(out, req, "Invalid date of birth");
+ }
+ if ( !"1".equals(req.getParameter("cca_agree"))) {
+ outputError(out, req, "You have to agree to the CAcert Community agreement.");
+ }
+ if (buildup.getEmail().equals("")) {
+ outputError(out, req, "Email Address was blank");
+ }
+ String pw1 = req.getParameter("pword1");
+ String pw2 = req.getParameter("pword2");
+ if (pw1 == null || pw1.equals("")) {
+ outputError(out, req, "Pass Phrases were blank");
+ } else if ( !pw1.equals(pw2)) {
+ outputError(out, req, "Pass Phrases don't match");
+ }
+ int pwpoints = PasswordStrengthChecker.checkpw(pw1, buildup);
+ if (pwpoints < 3) {
+ 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, buildup.getEmail());
+ q2.setString(1, buildup.getEmail());
+ 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, buildup.getEmail());