Add config method

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar 2021-03-02 21:32:45 +05:30
parent 600c7c5e8f
commit c00680f631
No known key found for this signature in database
GPG Key ID: 0D2CE231A7287EBC
7 changed files with 26 additions and 1 deletions

View File

@ -16,6 +16,10 @@ public class FontFunCaptcha implements ChallengeProvider {
return "FontFunCaptcha";
}
public void configure(String config) {
// TODO: Add custom config
}
private String getFontName(String path, String level) {
File file = new File(path + level + "/");
FilenameFilter txtFileFilter =

View File

@ -48,6 +48,10 @@ public class GifCaptcha implements ChallengeProvider {
return null;
}
public void configure(String config) {
// TODO: Add custom config
}
public Challenge returnChallenge() {
String secret = HelperFunctions.randomString(6);
return new Challenge(gifCaptcha(secret), "image/gif", secret.toLowerCase());

View File

@ -20,6 +20,10 @@ public class ShadowTextCaptcha implements ChallengeProvider {
return "ShadowTextCaptcha";
}
public void configure(String config) {
// TODO: Add custom config
}
public boolean checkAnswer(String secret, String answer) {
return answer.toLowerCase().equals(secret);
}

View File

@ -7,5 +7,5 @@ public interface ChallengeProvider {
public boolean checkAnswer(String secret, String answer);
// TODO: def configure(): Unit
public void configure(String config);
}

View File

@ -10,6 +10,11 @@ import lc.captchas.interfaces.Challenge
class FilterChallenge extends ChallengeProvider {
def getId = "FilterChallenge"
def configure(config: String): Unit = {
// TODO: add custom config
}
def returnChallenge(): Challenge = {
val filterTypes = List(new FilterType1, new FilterType2)
val r = new scala.util.Random

View File

@ -23,6 +23,10 @@ class LabelCaptcha extends ChallengeProvider {
def getId = "LabelCaptcha"
def configure(config: String): Unit = {
// TODO: add custom config
}
def returnChallenge(): Challenge =
synchronized {
val r = scala.util.Random.nextInt(knownFiles.length)

View File

@ -31,6 +31,10 @@ class RainDropsCP extends ChallengeProvider {
def getId = "FilterChallenge"
def configure(config: String): Unit = {
// TODO: add custom config
}
private def extendDrops(drops: Array[Drop], steps: Int, xOffset: Int) = {
drops.map(d => {
val nd = new Drop()