Try this
authorTheSaminator <TheSaminator@users.noreply.github.com>
Sun, 6 Feb 2022 22:49:13 +0000 (17:49 -0500)
committerTheSaminator <TheSaminator@users.noreply.github.com>
Sun, 6 Feb 2022 22:49:13 +0000 (17:49 -0500)
src/jvmMain/kotlin/starshipfights/auth/providers.kt

index 6251422239b721df15183f31305e5e23a4b60991..ac24f2c0d980195ea274dfb73245d447c05f98ca 100644 (file)
@@ -12,8 +12,6 @@ import io.ktor.routing.*
 import io.ktor.sessions.*
 import io.ktor.util.*
 import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.flow.filter
-import kotlinx.coroutines.flow.singleOrNull
 import kotlinx.coroutines.launch
 import kotlinx.html.*
 import starshipfights.CurrentConfiguration
@@ -197,10 +195,9 @@ object TestAuthProvider : AuthProvider {
                                        val userAgent = request.userAgent()
                                        if (userAgent != null && credentials.name.isValidUsername() && credentials.password == TEST_PASSWORD) {
                                                sfLogger.info("Attempting to find user ${credentials.name}")
-                                               // TODO find out why java mongodb driver is such a piece of shit
-                                               //val user = User.locate(User::username eq credentials.name)
-                                               val user = User.all().filter { it.username == credentials.name }.singleOrNull()
-                                                       ?: User(username = credentials.name).also {
+                                               val user = //User.locate(User::username eq credentials.name)
+                                                       //?: User(username = credentials.name).also {
+                                                       User(username = credentials.name).also {
                                                                sfLogger.info("Attempting to add user with name ${credentials.name}")
                                                                User.put(it)
                                                        }