mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-27 04:53:13 -05:00
FilterChallenge: adjust difficult based on parameter
This commit is contained in:
parent
444982e65f
commit
d797acdcac
@ -31,11 +31,12 @@ class FilterChallenge extends ChallengeProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def returnChallenge(level: String, size: String): Challenge = {
|
def returnChallenge(level: String, size: String): Challenge = {
|
||||||
|
val mediumLevel = level == "medium"
|
||||||
val filterTypes = List(new FilterType1, new FilterType2)
|
val filterTypes = List(new FilterType1, new FilterType2)
|
||||||
val r = new scala.util.Random
|
val r = new scala.util.Random
|
||||||
val alphabet = "abcdefghijklmnopqrstuvwxyz"
|
val characters = if (mediumLevel) HelperFunctions.safeAlphaNum else HelperFunctions.safeCharacters
|
||||||
val n = 8
|
val n = if (mediumLevel) 5 else 7
|
||||||
val secret = LazyList.continually(r.nextInt(alphabet.size)).map(alphabet).take(n).mkString
|
val secret = LazyList.continually(r.nextInt(characters.size)).map(characters).take(n).mkString
|
||||||
val size2D = HelperFunctions.parseSize2D(size)
|
val size2D = HelperFunctions.parseSize2D(size)
|
||||||
val width = size2D(0)
|
val width = size2D(0)
|
||||||
val height = size2D(1)
|
val height = size2D(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user