X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnlockSonePage.kt;h=f8cedb40d609915198fc87646234899610777c4f;hp=7ed2418be45a5da8b652b03dd651e7c6a827f186;hb=c28013c8a4bcb9776a1e2d82ffd6c4c8297ffb62;hpb=848fabcf16150e5f650c83490be6a2e7109d3ce6 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt index 7ed2418..f8cedb4 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -3,22 +3,23 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ -class UnlockSonePage(template: Template, webInterface: WebInterface): - SoneTemplatePage("unlockSone.html", template, "Page.UnlockSone.Title", webInterface, false) { +class UnlockSonePage @Inject constructor(template: Template, webInterface: WebInterface): + SoneTemplatePage("unlockSone.html", webInterface, template, "Page.UnlockSone.Title") { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - if (request.isPOST) { - request.parameters["sone", 44] - .let(webInterface.core::getLocalSone) - ?.also(webInterface.core::unlockSone) - throw RedirectException(request.parameters["returnPage", 256]) + override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { + if (soneRequest.isPOST) { + soneRequest.parameters["sone", 44] + .let(soneRequest.core::getLocalSone) + ?.also(soneRequest.core::unlockSone) + throw RedirectException(soneRequest.parameters["returnPage", 256]) } }