From: TheSaminator Date: Mon, 14 Feb 2022 18:08:52 +0000 (-0500) Subject: Remove column if IP addresses not logged X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=0b157ff63756588e0c54d7670c1f418a8c531dce;p=starship-fights Remove column if IP addresses not logged --- diff --git a/src/jvmMain/kotlin/starshipfights/info/views_user.kt b/src/jvmMain/kotlin/starshipfights/info/views_user.kt index cffb1ea..2fdede0 100644 --- a/src/jvmMain/kotlin/starshipfights/info/views_user.kt +++ b/src/jvmMain/kotlin/starshipfights/info/views_user.kt @@ -214,7 +214,8 @@ suspend fun ApplicationCall.manageUserPage(): HTML.() -> Unit { table { tr { th { +"User-Agent" } - th { +"Client IPs" } + if (currentUser.logIpAddresses) + th { +"Client IPs" } th { +Entities.nbsp } } val now = Instant.now() @@ -227,12 +228,13 @@ suspend fun ApplicationCall.manageUserPage(): HTML.() -> Unit { tr { td { +session.userAgent } - td { - session.clientAddresses.forEachIndexed { i, clientAddress -> - if (i != 0) br - +clientAddress + if (currentUser.logIpAddresses) + td { + session.clientAddresses.forEachIndexed { i, clientAddress -> + if (i != 0) br + +clientAddress + } } - } td { if (session.id == currentSession.id) { +"Current Session" @@ -244,19 +246,20 @@ suspend fun ApplicationCall.manageUserPage(): HTML.() -> Unit { } tr { td { - colSpan = "3" + colSpan = if (currentUser.logIpAddresses) "3" else "2" a(href = "/logout-all") { +"Logout All" } } } expiredSessions.forEach { session -> tr { td { +session.userAgent } - td { - session.clientAddresses.forEachIndexed { i, clientAddress -> - if (i != 0) br - +clientAddress + if (currentUser.logIpAddresses) + td { + session.clientAddresses.forEachIndexed { i, clientAddress -> + if (i != 0) br + +clientAddress + } } - } td { +"Expired at " span(classes = "moment") { @@ -271,7 +274,7 @@ suspend fun ApplicationCall.manageUserPage(): HTML.() -> Unit { if (expiredSessions.isNotEmpty()) tr { td { - colSpan = "3" + colSpan = if (currentUser.logIpAddresses) "3" else "2" a(href = "/clear-all-expired") { +"Clear All Expired Sessions" } } }