mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-26 04:23:14 -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 = {
|
||||
val mediumLevel = level == "medium"
|
||||
val filterTypes = List(new FilterType1, new FilterType2)
|
||||
val r = new scala.util.Random
|
||||
val alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||
val n = 8
|
||||
val secret = LazyList.continually(r.nextInt(alphabet.size)).map(alphabet).take(n).mkString
|
||||
val characters = if (mediumLevel) HelperFunctions.safeAlphaNum else HelperFunctions.safeCharacters
|
||||
val n = if (mediumLevel) 5 else 7
|
||||
val secret = LazyList.continually(r.nextInt(characters.size)).map(characters).take(n).mkString
|
||||
val size2D = HelperFunctions.parseSize2D(size)
|
||||
val width = size2D(0)
|
||||
val height = size2D(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user