diff --git a/.gradle/9.5.1/checksums/checksums.lock b/.gradle/9.5.1/checksums/checksums.lock
deleted file mode 100644
index bc7c017..0000000
Binary files a/.gradle/9.5.1/checksums/checksums.lock and /dev/null differ
diff --git a/.gradle/9.5.1/checksums/md5-checksums.bin b/.gradle/9.5.1/checksums/md5-checksums.bin
deleted file mode 100644
index b13b569..0000000
Binary files a/.gradle/9.5.1/checksums/md5-checksums.bin and /dev/null differ
diff --git a/.gradle/9.5.1/checksums/sha1-checksums.bin b/.gradle/9.5.1/checksums/sha1-checksums.bin
deleted file mode 100644
index 9863cc2..0000000
Binary files a/.gradle/9.5.1/checksums/sha1-checksums.bin and /dev/null differ
diff --git a/.gradle/9.5.1/executionHistory/executionHistory.bin b/.gradle/9.5.1/executionHistory/executionHistory.bin
deleted file mode 100644
index c9e6c59..0000000
Binary files a/.gradle/9.5.1/executionHistory/executionHistory.bin and /dev/null differ
diff --git a/.gradle/9.5.1/executionHistory/executionHistory.lock b/.gradle/9.5.1/executionHistory/executionHistory.lock
deleted file mode 100644
index 2e9dfd0..0000000
Binary files a/.gradle/9.5.1/executionHistory/executionHistory.lock and /dev/null differ
diff --git a/.gradle/9.5.1/expanded/expanded.lock b/.gradle/9.5.1/expanded/expanded.lock
deleted file mode 100644
index 8227d08..0000000
Binary files a/.gradle/9.5.1/expanded/expanded.lock and /dev/null differ
diff --git a/.gradle/9.5.1/fileChanges/last-build.bin b/.gradle/9.5.1/fileChanges/last-build.bin
deleted file mode 100644
index f76dd23..0000000
Binary files a/.gradle/9.5.1/fileChanges/last-build.bin and /dev/null differ
diff --git a/.gradle/9.5.1/fileHashes/fileHashes.bin b/.gradle/9.5.1/fileHashes/fileHashes.bin
deleted file mode 100644
index cede7e6..0000000
Binary files a/.gradle/9.5.1/fileHashes/fileHashes.bin and /dev/null differ
diff --git a/.gradle/9.5.1/fileHashes/fileHashes.lock b/.gradle/9.5.1/fileHashes/fileHashes.lock
deleted file mode 100644
index c73a39b..0000000
Binary files a/.gradle/9.5.1/fileHashes/fileHashes.lock and /dev/null differ
diff --git a/.gradle/9.5.1/fileHashes/resourceHashesCache.bin b/.gradle/9.5.1/fileHashes/resourceHashesCache.bin
deleted file mode 100644
index f56fd0d..0000000
Binary files a/.gradle/9.5.1/fileHashes/resourceHashesCache.bin and /dev/null differ
diff --git a/.gradle/9.5.1/gc.properties b/.gradle/9.5.1/gc.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/.gradle/9.5.1/kotlin-dsl-plugin-entries/jar-entries.bin b/.gradle/9.5.1/kotlin-dsl-plugin-entries/jar-entries.bin
deleted file mode 100644
index efb4389..0000000
Binary files a/.gradle/9.5.1/kotlin-dsl-plugin-entries/jar-entries.bin and /dev/null differ
diff --git a/.gradle/9.5.1/kotlin-dsl-plugin-entries/kotlin-dsl-plugin-entries.lock b/.gradle/9.5.1/kotlin-dsl-plugin-entries/kotlin-dsl-plugin-entries.lock
deleted file mode 100644
index 4182776..0000000
Binary files a/.gradle/9.5.1/kotlin-dsl-plugin-entries/kotlin-dsl-plugin-entries.lock and /dev/null differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
deleted file mode 100644
index 6477dfb..0000000
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and /dev/null differ
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
deleted file mode 100644
index 12581dd..0000000
--- a/.gradle/buildOutputCleanup/cache.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-#Wed Sep 02 15:03:29 CEST 2026
-gradle.version=9.5.1
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
deleted file mode 100644
index ed0ea2b..0000000
Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ
diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe
deleted file mode 100644
index 1fe2894..0000000
Binary files a/.gradle/file-system.probe and /dev/null differ
diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 30cf57e..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Ignored default folder with query files
-/queries/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index b86273d..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
deleted file mode 100644
index 34f60dc..0000000
--- a/.idea/dataSources.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
- postgresql
- true
- org.postgresql.Driver
- jdbc:postgresql://82.165.11.162:5432/kidio_db
- $ProjectFileDir$
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index ce1c62c..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index 7ca2a83..0000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 8d64e29..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Kidio_backend.iml b/Kidio_backend.iml
deleted file mode 100644
index d6ebd48..0000000
--- a/Kidio_backend.iml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/kotlin/com/oliver/kidio/backend/plugins/Routing.kt b/src/main/kotlin/com/oliver/kidio/backend/plugins/Routing.kt
index 3b82b15..6ea30bd 100644
--- a/src/main/kotlin/com/oliver/kidio/backend/plugins/Routing.kt
+++ b/src/main/kotlin/com/oliver/kidio/backend/plugins/Routing.kt
@@ -14,6 +14,26 @@ import io.ktor.server.routing.*
import org.mindrot.jbcrypt.BCrypt
import java.util.UUID
+fun isValidPassword(password: String): Boolean {
+ if (password.length < 8) return false
+
+ val hasUppercase = password.any { it.isUpperCase() }
+ val hasEmoji =
+ password.any { char ->
+ val type = Character.getType(char).toByte()
+ type == Character.SURROGATE ||
+ type == Character.OTHER_SYMBOL ||
+ char.code in 0x1F600..0x1F64F ||
+ char.code in 0x1F300..0x1F5FF ||
+ char.code in 0x1F680..0x1F6FF ||
+ char.code in 0x2600..0x26FF
+ }
+
+ val hasSpecialChar = password.any { !it.isLetterOrDigit() && !hasEmoji }
+
+ return hasUppercase && hasSpecialChar && !hasEmoji
+}
+
fun Application.configureRouting(
repository: KidioRepository,
jwtService: JwtService,
@@ -27,6 +47,14 @@ fun Application.configureRouting(
call.respond(HttpStatusCode.BadRequest, "Bitte füllen Sie alle Felder aus")
return@post
}
+ if (!isValidPassword(registerRequest.passwordPlain)) {
+ call.respond(
+ HttpStatusCode.BadRequest,
+ "Das Passwort muss mindestens 8 Zeichen lang sein, " +
+ "mindestens einen Großbuchstaben und ein Sonderzeichen enthalten.",
+ )
+ return@post
+ }
if (registerRequest.parentPin.length != 4) {
call.respond(HttpStatusCode.BadRequest, "Die Eltern-PIN muss genau 4 Ziffern lang sein")
return@post
diff --git a/src/test/kotlin/ServerTest.kt b/src/test/kotlin/ServerTest.kt
index dabd653..ceda5b0 100644
--- a/src/test/kotlin/ServerTest.kt
+++ b/src/test/kotlin/ServerTest.kt
@@ -112,7 +112,7 @@ class ServerTest {
setBody(
"""{
"email": "test@family.de",
- "passwordPlain": "strengGeheim1",
+ "passwordPlain": "StrengGeheim1!",
"familyName": "Familie Schmidt",
"childAge": 8,
"parentPin": "4321"
@@ -129,7 +129,7 @@ class ServerTest {
setBody(
"""{
"email": "test@family.de",
- "passwordPlain": "strengGeheim1"
+ "passwordPlain": "StrengGeheim1!"
}""",
)
}
@@ -139,6 +139,50 @@ class ServerTest {
assertEquals("Familie Schmidt", loginJson.familyName)
}
+ @Test
+ fun `test registration rejects invalid passwords`() =
+ testApplication {
+ val jwtService = JwtService()
+ val repository = InMemoryKidioRepository()
+
+ application {
+ install(ServerContentNegotiation) {
+ json()
+ }
+ configureSecurity(jwtService)
+ configureRouting(repository, jwtService)
+ }
+
+ val invalidPasswords =
+ listOf(
+ "Kurz1!",
+ "keingrossbuch1!",
+ "KeinSonder12",
+ "Passwort123!😊",
+ )
+
+ for (password in invalidPasswords) {
+ val response =
+ client.post("/api/v1/auth/register") {
+ header(HttpHeaders.ContentType, ContentType.Application.Json.toString())
+ setBody(
+ """{
+ "email": "test_${System.currentTimeMillis()}@family.de",
+ "passwordPlain": "$password",
+ "familyName": "Familie Schmidt",
+ "childAge": 8,
+ "parentPin": "4321"
+ }""",
+ )
+ }
+ assertEquals(
+ HttpStatusCode.BadRequest,
+ response.status,
+ "Passwort '$password' hätte abgelehnt werden müssen!",
+ )
+ }
+ }
+
@Test
fun `test tasks endpoint and verify with jwt`() =
testApplication {