From bd922f8a3a552de99aa944f0f6a5f3ea06fdaa1f Mon Sep 17 00:00:00 2001 From: TheSaminator Date: Sun, 6 Feb 2022 17:49:13 -0500 Subject: [PATCH] Try this --- src/jvmMain/kotlin/starshipfights/auth/providers.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/jvmMain/kotlin/starshipfights/auth/providers.kt b/src/jvmMain/kotlin/starshipfights/auth/providers.kt index 6251422..ac24f2c 100644 --- a/src/jvmMain/kotlin/starshipfights/auth/providers.kt +++ b/src/jvmMain/kotlin/starshipfights/auth/providers.kt @@ -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) } -- 2.25.1