makes the server check the recaptcha depending on whether there is a private key

This commit is contained in:
Timothy Prepscius 2013-09-29 18:26:36 -04:00
parent ab9b7507ae
commit fc9403fde6
4 changed files with 10 additions and 9 deletions

View File

@ -51,4 +51,6 @@ public class ConstantsServer
public static final int MAXIMUM_MAIL_SIZE = 1024 * 1024 * 1;
public static final int AUTH_TIMEOUT = 45;
public static final String RECAPTCHA_PRIVATE_KEY = "captcha_private_key";
}

View File

@ -4,34 +4,33 @@
*/
package mail.streamserver;
import java.io.IOException;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.Random;
import mail.server.db.ExternalData;
import mail.server.db.ExternalDataFactory;
import mail.server.db.MailUserDb;
import org.apache.james.cli.probe.impl.JmxServerProbe;
import core.constants.ConstantsEnvironmentKeys;
import core.constants.ConstantsServer;
import core.exceptions.InternalException;
import core.exceptions.PublicMessageException;
import core.server.captcha.Captcha;
import core.server.mailextra.MailExtraDb;
import core.srp.server.SRPServerUserSessionDb;
import core.util.Environment;
import core.util.ExternalResource;
import core.util.JSONSerializer;
import core.util.LogOut;
import core.util.SimpleSerializer;
import core.util.Strings;
import core.util.Triple;
public class MailServerSessionDb implements SRPServerUserSessionDb
{
static final boolean USE_CAPTCHA = true;
boolean USE_CAPTCHA =
!ExternalResource.
getTrimmedString(ConstantsServer.RECAPTCHA_PRIVATE_KEY).equals("NONE");
static LogOut log = new LogOut(MailServerSessionDb.class);
@ -39,7 +38,7 @@ public class MailServerSessionDb implements SRPServerUserSessionDb
MailExtraDb payment;
Captcha captcha;
public MailServerSessionDb (MailUserDb db) throws SQLException, IOException
public MailServerSessionDb (MailUserDb db) throws Exception
{
this.db = db;
this.captcha = new Captcha();

View File

@ -73,7 +73,7 @@ public class CaptchaResponse extends HttpServlet {
{
String remoteAddr = request.getRemoteAddr();
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
reCaptcha.setPrivateKey(ExternalResource.getTrimmedString("captcha_private_key"));
reCaptcha.setPrivateKey(ExternalResource.getTrimmedString(ConstantsServer.RECAPTCHA_PRIVATE_KEY));
String challenge = request.getParameter("recaptcha_challenge_field");
String uresponse = request.getParameter("recaptcha_response_field");

View File

@ -1 +1 @@
THIS IS THE PRIVATE KEY PROVIDED BY GOOGLE RECAPTCHA
NONE