X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FLoginPage.kt;h=624432578c4c1f3074bb667e7f6e9e69c0ac55d4;hp=6647cd4c2f5563a3e3718f4617d7ff386b235184;hb=HEAD;hpb=76f3cee76957a00d6cb8f1ebcef9a2af3be7b603 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt index 6647cd4..6244325 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt @@ -13,8 +13,9 @@ import javax.inject.* */ @MenuName("Login") @TemplatePath("/templates/login.html") +@ToadletPath("login.html") class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - SoneTemplatePage("login.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Login.Title") { + SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.Login.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { if (soneRequest.isPOST) { @@ -22,10 +23,10 @@ class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders soneRequest.core.getLocalSone(soneId)?.let { sone -> setCurrentSone(soneRequest.toadletContext, sone) val target = soneRequest.httpRequest.getParam("target").emptyToNull ?: "index.html" - throw RedirectException(target) + redirectTo(target) } } - templateContext["sones"] = soneRequest.core.localSones.sortedWith(Sone.NICE_NAME_COMPARATOR) + templateContext["sones"] = soneRequest.core.localSones.sortedWith(niceNameComparator) templateContext["identitiesWithoutSone"] = soneRequest.core.identityManager.allOwnIdentities.filterNot { "Sone" in it.contexts }.sortedBy { "${it.nickname}@${it.id}" } }