X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteProfileFieldPage.kt;h=cf5ac6e2d8dec1d8f4474e2940e7d9522b8fb72c;hp=63cf17fb59e2d28c99bfe0d66c2918a11724ce29;hb=3cb0e2c78bb37f2d70ecde92ad4fcf642de788a3;hpb=cec099ef08feaff5332b81885ad989dbcb0fdfba diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt index 63cf17f..cf5ac6e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt @@ -12,16 +12,16 @@ import net.pterodactylus.util.template.TemplateContext class DeleteProfileFieldPage(template: Template, webInterface: WebInterface): SoneTemplatePage("deleteProfileField.html", template, "Page.DeleteProfileField.Title", webInterface, true) { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - val currentSone = getCurrentSone(request.toadletContext)!! - if (request.isPOST) { - val field = currentSone.profile.getFieldById(request.httpRequest.getPartAsStringFailsafe("field", 36)) ?: throw RedirectException("invalid.html") - if (request.httpRequest.getPartAsStringFailsafe("confirm", 4) == "true") { + override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + val currentSone = getCurrentSone(freenetRequest.toadletContext)!! + if (freenetRequest.isPOST) { + val field = currentSone.profile.getFieldById(freenetRequest.httpRequest.getPartAsStringFailsafe("field", 36)) ?: throw RedirectException("invalid.html") + if (freenetRequest.httpRequest.getPartAsStringFailsafe("confirm", 4) == "true") { currentSone.profile = currentSone.profile.apply { removeField(field) } } throw RedirectException("editProfile.html#profile-fields") } - val field = currentSone.profile.getFieldById(request.httpRequest.getParam("field")) ?: throw RedirectException("invalid.html") + val field = currentSone.profile.getFieldById(freenetRequest.httpRequest.getParam("field")) ?: throw RedirectException("invalid.html") templateContext["field"] = field }