1 package net.pterodactylus.sone.web.pages
3 import freenet.clients.http.ToadletContext
4 import net.pterodactylus.sone.data.Sone
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
9 import javax.inject.Inject
14 class LogoutPage @Inject constructor(template: Template, webInterface: WebInterface):
15 LoggedInPage("logout.html", template, "Page.Logout.Title", webInterface) {
17 override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
18 setCurrentSone(freenetRequest.toadletContext, null)
19 throw RedirectException("index.html")
22 override fun isEnabled(toadletContext: ToadletContext): Boolean =
23 if (webInterface.core.preferences.isRequireFullAccess && !toadletContext.isAllowedFullAccess) {
26 getCurrentSone(toadletContext) != null && webInterface.core.localSones.size != 1