mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-02-12 11:18:07 -05:00
ensure fresh captchas are served by sorting on attempted
Signed-off-by: hrj <harshad.rj@gmail.com>
This commit is contained in:
parent
7684b68efd
commit
2885decb56
@ -19,7 +19,10 @@ class Statements(dbConn: DBConn, maxAttempts: Int) {
|
||||
"contentInput varchar, " +
|
||||
"image blob, " +
|
||||
"attempted int default 0, " +
|
||||
"PRIMARY KEY(token))"
|
||||
"PRIMARY KEY(token));" +
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS attempted ON challenge(attempted);
|
||||
"""
|
||||
)
|
||||
stmt.execute(
|
||||
"CREATE TABLE IF NOT EXISTS mapId" +
|
||||
@ -69,13 +72,13 @@ class Statements(dbConn: DBConn, maxAttempts: Int) {
|
||||
|
||||
val tokenPstmt: PreparedStatement = dbConn.con.prepareStatement(
|
||||
s"""
|
||||
SELECT token
|
||||
SELECT token, attempted
|
||||
FROM challenge
|
||||
WHERE attempted < $maxAttempts AND
|
||||
contentLevel = ? AND
|
||||
contentType = ? AND
|
||||
contentInput = ?
|
||||
ORDER BY RAND() LIMIT 1"""
|
||||
ORDER BY attempted ASC LIMIT 1"""
|
||||
)
|
||||
|
||||
val deleteAnswerPstmt: PreparedStatement = dbConn.con.prepareStatement(
|
||||
|
Loading…
x
Reference in New Issue
Block a user