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=450a4664c79fb019be3b517520905c0f2d726f9a;hp=b39c9dad17ecbe7f9e1d1226728689f3fda0936a;hb=aaf780d3c2a6f5ce47295786f3963c8b93f6a145;hpb=6a3f1fede0cda5cd6ed56204aa1dd37a19813cb9 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 b39c9da..450a466 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -1,26 +1,25 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.main.* -import net.pterodactylus.sone.utils.isPOST -import net.pterodactylus.sone.utils.parameters -import net.pterodactylus.sone.web.WebInterface +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext -import javax.inject.Inject +import net.pterodactylus.util.template.* +import javax.inject.* /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ -class UnlockSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders): - SoneTemplatePage("unlockSone.html", webInterface, loaders, template = template, pageTitleKey = "Page.UnlockSone.Title") { +@ToadletPath("unlockSone.html") +class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { 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]) + redirectTo(soneRequest.parameters["returnPage", 256]) } }