diff --git a/src/main/scala/lc/background/taskThread.scala b/src/main/scala/lc/background/taskThread.scala index e48276a..c6cfe7e 100644 --- a/src/main/scala/lc/background/taskThread.scala +++ b/src/main/scala/lc/background/taskThread.scala @@ -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 diff --git a/src/main/scala/lc/core/captcha.scala b/src/main/scala/lc/core/captcha.scala index b0c2b9a..ff8ac3a 100644 --- a/src/main/scala/lc/core/captcha.scala +++ b/src/main/scala/lc/core/captcha.scala @@ -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") diff --git a/src/main/scala/lc/database/statements.scala b/src/main/scala/lc/database/statements.scala index f165d9d..1439b56 100644 --- a/src/main/scala/lc/database/statements.scala +++ b/src/main/scala/lc/database/statements.scala @@ -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(