1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.main.*
4 import net.pterodactylus.sone.utils.*
5 import net.pterodactylus.sone.web.*
6 import net.pterodactylus.sone.web.page.*
7 import net.pterodactylus.util.template.*
11 * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion.
13 @ToadletPath("unlockSone.html")
14 class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
15 SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") {
17 override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) {
18 if (soneRequest.isPOST) {
19 soneRequest.parameters["sone", 44]
20 .let(soneRequest.core::getLocalSone)
21 ?.also(soneRequest.core::unlockSone)
22 redirectTo(soneRequest.parameters["returnPage", 256])