mirror of
https://github.com/moparisthebest/mailiverse
synced 2024-11-25 01:52:15 -05:00
makes captcha not activate if no private key
This commit is contained in:
parent
d3c696eb89
commit
2682dc1a8d
@ -16,12 +16,20 @@ import java.sql.SQLException;
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import core.constants.ConstantsServer;
|
||||||
import core.server.captcha.sql.Catalog;
|
import core.server.captcha.sql.Catalog;
|
||||||
|
import core.util.ExternalResource;
|
||||||
|
import core.util.LogOut;
|
||||||
import core.util.Passwords;
|
import core.util.Passwords;
|
||||||
|
|
||||||
|
|
||||||
public class Captcha
|
public class Captcha
|
||||||
{
|
{
|
||||||
|
boolean USE_CAPTCHA =
|
||||||
|
!ExternalResource.
|
||||||
|
getTrimmedString(ConstantsServer.RECAPTCHA_PRIVATE_KEY).equals("NONE");
|
||||||
|
|
||||||
|
static LogOut log = new LogOut(Captcha.class);
|
||||||
Random random = new SecureRandom();
|
Random random = new SecureRandom();
|
||||||
Catalog catalog = new Catalog();
|
Catalog catalog = new Catalog();
|
||||||
|
|
||||||
@ -29,6 +37,11 @@ public class Captcha
|
|||||||
SignUp = "SignUp",
|
SignUp = "SignUp",
|
||||||
CreateBucket = "CreateBucket";
|
CreateBucket = "CreateBucket";
|
||||||
|
|
||||||
|
public Captcha () throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void prune () throws SQLException, IOException
|
public void prune () throws SQLException, IOException
|
||||||
{
|
{
|
||||||
Connection connection = openConnection();
|
Connection connection = openConnection();
|
||||||
@ -76,6 +89,12 @@ public class Captcha
|
|||||||
{
|
{
|
||||||
prune();
|
prune();
|
||||||
|
|
||||||
|
if (!USE_CAPTCHA)
|
||||||
|
{
|
||||||
|
log.debug("Not using captcha, because no private key present.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Connection connection = openConnection();
|
Connection connection = openConnection();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -28,11 +28,6 @@ import core.util.Triple;
|
|||||||
|
|
||||||
public class MailServerSessionDb implements SRPServerUserSessionDb
|
public class MailServerSessionDb implements SRPServerUserSessionDb
|
||||||
{
|
{
|
||||||
boolean USE_CAPTCHA =
|
|
||||||
!ExternalResource.
|
|
||||||
getTrimmedString(ConstantsServer.RECAPTCHA_PRIVATE_KEY).equals("NONE");
|
|
||||||
|
|
||||||
|
|
||||||
static LogOut log = new LogOut(MailServerSessionDb.class);
|
static LogOut log = new LogOut(MailServerSessionDb.class);
|
||||||
MailUserDb db;
|
MailUserDb db;
|
||||||
MailExtraDb payment;
|
MailExtraDb payment;
|
||||||
@ -79,13 +74,8 @@ public class MailServerSessionDb implements SRPServerUserSessionDb
|
|||||||
{
|
{
|
||||||
ExternalData externalData = ExternalDataFactory.createInstance();
|
ExternalData externalData = ExternalDataFactory.createInstance();
|
||||||
|
|
||||||
if (USE_CAPTCHA)
|
|
||||||
{
|
|
||||||
String token = SimpleSerializer.deserialize(extra);
|
String token = SimpleSerializer.deserialize(extra);
|
||||||
captcha.useToken(token, Captcha.SignUp);
|
captcha.useToken(token, Captcha.SignUp);
|
||||||
}
|
|
||||||
else
|
|
||||||
System.out.println("Not checking captcha!");
|
|
||||||
|
|
||||||
db.createUser(version, userName, v.toByteArray(), s.toByteArray());
|
db.createUser(version, userName, v.toByteArray(), s.toByteArray());
|
||||||
payment.addDaysTo(userName,0);
|
payment.addDaysTo(userName,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user