1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.utils.isPOST
4 import net.pterodactylus.sone.utils.parameters
5 import net.pterodactylus.sone.web.WebInterface
6 import net.pterodactylus.sone.web.page.FreenetRequest
7 import net.pterodactylus.util.template.Template
8 import net.pterodactylus.util.template.TemplateContext
11 * Page that lets the user untrust another Sone. This will remove all trust
12 * assignments for an identity.
14 class UntrustPage(template: Template, webInterface: WebInterface):
15 SoneTemplatePage("untrust.html", template, "Page.Untrust.Title", webInterface, true) {
17 override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
18 if (freenetRequest.isPOST) {
19 getCurrentSone(freenetRequest.toadletContext)!!.also { currentSone ->
20 freenetRequest.parameters["sone", 44]!!
21 .let(webInterface.core::getSone)
22 ?.also { webInterface.core.untrustSone(currentSone, it) }
24 throw RedirectException(freenetRequest.parameters["returnPage", 256])