1 package net.pterodactylus.sone.web.pages
3 import freenet.clients.http.ToadletContext
4 import net.pterodactylus.sone.web.WebInterface
5 import net.pterodactylus.sone.web.page.FreenetRequest
6 import net.pterodactylus.util.template.Template
7 import net.pterodactylus.util.template.TemplateContext
12 class LogoutPage(template: Template, webInterface: WebInterface):
13 SoneTemplatePage("logout.html", template, "Page.Logout.Title", webInterface, true) {
15 override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
16 setCurrentSone(freenetRequest.toadletContext, null)
17 throw RedirectException("index.html")
20 override fun isEnabled(toadletContext: ToadletContext): Boolean =
21 if (webInterface.core.preferences.isRequireFullAccess && !toadletContext.isAllowedFullAccess) {
24 getCurrentSone(toadletContext) != null && webInterface.core.localSones.size != 1