Remember CSRF tokens
authorLanius Trolling <lanius@laniustrolling.dev>
Mon, 13 May 2024 23:12:14 +0000 (19:12 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Mon, 13 May 2024 23:12:14 +0000 (19:12 -0400)
src/jvmMain/kotlin/info/mechyrdia/robot/ViewsRobot.kt

index fe0e9473be06b0f652dac3ed229505f9c95e46f4..7e8b83ac2b1318e603a2042fa70ac09963887b4d 100644 (file)
@@ -9,6 +9,7 @@ import info.mechyrdia.lore.standardNavBar
 import info.mechyrdia.route.Root
 import info.mechyrdia.route.checkCsrfToken
 import info.mechyrdia.route.href
+import info.mechyrdia.route.installCsrfToken
 import io.ktor.server.application.*
 import io.ktor.server.websocket.*
 import io.ktor.websocket.*
@@ -99,6 +100,7 @@ fun ApplicationCall.robotManagementPage(): HTML.() -> Unit {
                                RobotServiceStatus.READY -> ul {
                                        li {
                                                form(action = href(Root.Admin.NukeManagement.Update()), method = FormMethod.post) {
+                                                       installCsrfToken()
                                                        submitInput {
                                                                value = "Manually Trigger File Update"
                                                        }
@@ -106,6 +108,7 @@ fun ApplicationCall.robotManagementPage(): HTML.() -> Unit {
                                        }
                                        li {
                                                form(action = href(Root.Admin.NukeManagement.Reset()), method = FormMethod.post) {
+                                                       installCsrfToken()
                                                        submitInput(classes = "evil") {
                                                                value = "Reset All Data And Start Over"
                                                        }