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