mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-13 06:53:19 -05:00
gracefully handle wrong input from API
This commit is contained in:
parent
644a106a31
commit
239bf2cefc
@ -110,10 +110,13 @@ class Captcha(throttle: Int) extends DBConn {
|
|||||||
def checkAnswer(answer: Answer): Boolean = {
|
def checkAnswer(answer: Answer): Boolean = {
|
||||||
selectPstmt.setString(1, answer.id)
|
selectPstmt.setString(1, answer.id)
|
||||||
val rs: ResultSet = selectPstmt.executeQuery()
|
val rs: ResultSet = selectPstmt.executeQuery()
|
||||||
rs.next()
|
if (rs.first()) {
|
||||||
val secret = rs.getString("secret")
|
val secret = rs.getString("secret")
|
||||||
val provider = rs.getString("provider")
|
val provider = rs.getString("provider")
|
||||||
providers(provider).checkAnswer(secret, answer.answer)
|
providers(provider).checkAnswer(secret, answer.answer)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getHash(email: String): Int = {
|
def getHash(email: String): Int = {
|
||||||
|
Loading…
Reference in New Issue
Block a user