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=e792318ecfd7ae2fc90a812f351afb16c68d7a4d;hb=c28013c8a4bcb9776a1e2d82ffd6c4c8297ffb62;hpb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae 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 e792318..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(freenetRequest: FreenetRequest, templateContext: TemplateContext) { - if (freenetRequest.isPOST) { - freenetRequest.parameters["sone", 44] - .let(webInterface.core::getLocalSone) - ?.also(webInterface.core::unlockSone) - throw RedirectException(freenetRequest.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]) } }