mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-12 14:33:20 -05:00
minor simplification
This commit is contained in:
parent
a54947cfc2
commit
c8db914cfd
@ -34,17 +34,13 @@ class CaptchaManager(config: Config, captchaProviders: CaptchaProviders) {
|
||||
}
|
||||
|
||||
def generateChallenge(param: Parameters): Option[Int] = {
|
||||
val provider = captchaProviders.getProvider(param)
|
||||
provider match {
|
||||
case Some(value) => {
|
||||
val providerId = value.getId()
|
||||
val challenge = value.returnChallenge()
|
||||
captchaProviders.getProvider(param).flatMap { provider =>
|
||||
val providerId = provider.getId()
|
||||
val challenge = provider.returnChallenge()
|
||||
val blob = new ByteArrayInputStream(challenge.content)
|
||||
val token = insertCaptcha(value, challenge, providerId, param, blob)
|
||||
val token = insertCaptcha(provider, challenge, providerId, param, blob)
|
||||
// println("Added new challenge: " + token.toString)
|
||||
token.map(_.toInt)
|
||||
}
|
||||
case None => None
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user