mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-12 22:43:20 -05:00
Add config time support to captcha expiry
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
parent
d9ff3a14b9
commit
6c4a3d0152
@ -12,6 +12,7 @@ class BackgroundTask(captcha: Captcha, throttle: Int, timeLimit: Int) {
|
||||
try {
|
||||
|
||||
val mapIdGCPstmt = Statements.tlStmts.get.mapIdGCPstmt
|
||||
mapIdGCPstmt.setInt(1, timeLimit)
|
||||
mapIdGCPstmt.executeUpdate()
|
||||
|
||||
val challengeGCPstmt = Statements.tlStmts.get.challengeGCPstmt
|
||||
|
@ -115,7 +115,8 @@ class Captcha {
|
||||
|
||||
def checkAnswer(answer: Answer): Result = {
|
||||
val selectPstmt = Statements.tlStmts.get.selectPstmt
|
||||
selectPstmt.setString(1, answer.id)
|
||||
selectPstmt.setInt(1, Config.getCaptchaExpiryTimeLimit)
|
||||
selectPstmt.setString(2, answer.id)
|
||||
val rs: ResultSet = selectPstmt.executeQuery()
|
||||
val psOpt = if (rs.first()) {
|
||||
val secret = rs.getString("secret")
|
||||
|
@ -50,7 +50,7 @@ class Statements(dbConn: DBConn) {
|
||||
"SELECT c.secret, c.provider " +
|
||||
"FROM challenge c, mapId m " +
|
||||
"WHERE m.token=c.token AND " +
|
||||
"DATEDIFF(MINUTE, CURRENT_TIMESTAMP, DATEADD(MINUTE, 5, m.lastServed)) > 0 AND " +
|
||||
"DATEDIFF(MINUTE, CURRENT_TIMESTAMP, DATEADD(MINUTE, ?, m.lastServed)) > 0 AND " +
|
||||
"m.uuid = ?"
|
||||
)
|
||||
|
||||
@ -91,7 +91,7 @@ class Statements(dbConn: DBConn) {
|
||||
)
|
||||
|
||||
val mapIdGCPstmt: PreparedStatement = dbConn.con.prepareStatement(
|
||||
"DELETE FROM mapId WHERE DATEDIFF(MINUTE, CURRENT_TIMESTAMP, DATEADD(MINUTE, 5, lastServed)) < 0"
|
||||
"DELETE FROM mapId WHERE DATEDIFF(MINUTE, CURRENT_TIMESTAMP, DATEADD(MINUTE, ?, lastServed)) < 0"
|
||||
)
|
||||
|
||||
val getCountChallengeTable: PreparedStatement = dbConn.con.prepareStatement(
|
||||
|
Loading…
Reference in New Issue
Block a user