mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-04-19 02:05:17 -04:00
raindrops: vary length based on level, and use safe alphaNumeric characters
This commit is contained in:
parent
3aeb258851
commit
caf03d7a48
@ -25,8 +25,6 @@ class Drop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RainDropsCP extends ChallengeProvider {
|
class RainDropsCP extends ChallengeProvider {
|
||||||
private val alphabet = "abcdefghijklmnopqrstuvwxyz"
|
|
||||||
private val n = 6
|
|
||||||
private val bgColor = new Color(200, 200, 200)
|
private val bgColor = new Color(200, 200, 200)
|
||||||
private val textColor = new Color(208, 208, 218)
|
private val textColor = new Color(208, 208, 218)
|
||||||
private val textHighlightColor = new Color(100, 100, 125)
|
private val textHighlightColor = new Color(100, 100, 125)
|
||||||
@ -59,7 +57,8 @@ class RainDropsCP extends ChallengeProvider {
|
|||||||
|
|
||||||
def returnChallenge(level: String, size: String): Challenge = {
|
def returnChallenge(level: String, size: String): Challenge = {
|
||||||
val r = new scala.util.Random
|
val r = new scala.util.Random
|
||||||
val secret = LazyList.continually(r.nextInt(alphabet.size)).map(alphabet).take(n).mkString
|
val n = if (level == "easy") 4 else 6
|
||||||
|
val secret = HelperFunctions.randomString(n, HelperFunctions.safeAlphaNum)
|
||||||
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