diff --git a/src/main/scala/lc/DB.scala b/src/main/scala/lc/DB.scala index ca83557..3dd5e84 100644 --- a/src/main/scala/lc/DB.scala +++ b/src/main/scala/lc/DB.scala @@ -13,7 +13,7 @@ class DBConn(){ lazy val userPstmt: PreparedStatement = con.prepareStatement("INSERT INTO users(email, hash) VALUES (?,?)") lazy val validatePstmt: PreparedStatement = con.prepareStatement("SELECT hash FROM users WHERE hash = ? LIMIT 1") - def getConn(): Statement = { + def getStatement(): Statement = { con.createStatement() } diff --git a/src/main/scala/lc/Main.scala b/src/main/scala/lc/Main.scala index f03ae4b..d17d493 100644 --- a/src/main/scala/lc/Main.scala +++ b/src/main/scala/lc/Main.scala @@ -16,7 +16,7 @@ case class ProviderSecret(provider: String, secret: String) class Captcha(throttle: Int) extends DBConn { - val stmt = getConn() + val stmt = getStatement() stmt.execute("CREATE TABLE IF NOT EXISTS challenge(token varchar, id varchar, secret varchar, provider varchar, contentType varchar, image blob, solved boolean default False, PRIMARY KEY(token))") stmt.execute("CREATE TABLE IF NOT EXISTS mapId(uuid varchar, token varchar, PRIMARY KEY(uuid), FOREIGN KEY(token) REFERENCES challenge(token))") stmt.execute("CREATE TABLE IF NOT EXISTS users(email varchar, hash int)") diff --git a/src/main/scala/lc/Server.scala b/src/main/scala/lc/Server.scala index d40e957..d75e45d 100644 --- a/src/main/scala/lc/Server.scala +++ b/src/main/scala/lc/Server.scala @@ -10,7 +10,6 @@ import lc.HTTPServer._ case class Secret(token: Int) class RateLimiter extends DBConn { - val stmt = getConn() val userLastActive = collection.mutable.Map[Int, Long]() val userAllowance = collection.mutable.Map[Int, Double]() val rate = 8.0