From a93a178b57b8a41dee4c6c83acb2f613508b1bf1 Mon Sep 17 00:00:00 2001 From: iou1name Date: Wed, 25 Sep 2019 15:00:29 -0400 Subject: [PATCH] add active sessions section --- buckler.py | 4 ++++ templates/index.html | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/buckler.py b/buckler.py index 0988958..d3dfca0 100644 --- a/buckler.py +++ b/buckler.py @@ -44,6 +44,10 @@ async def index(request): fido2_keys = await conn.fetch( "SELECT * FROM user_credential WHERE user_id = $1", request['session']['id']) + active_sessions = await conn.fetch( + "SELECT ip_address FROM user_session " + "WHERE user_id = $1", + request['session']['id']) if request['session']['admin']: apps = [app['name'] for app in apps] diff --git a/templates/index.html b/templates/index.html index cb8c878..54a5f06 100644 --- a/templates/index.html +++ b/templates/index.html @@ -29,7 +29,7 @@ {% if request['session']['admin'] %}

User Permissions

-
+

@@ -58,7 +58,7 @@ {% endif %}

Change Password

-
+

@@ -73,7 +73,7 @@

Security Keys

-
+

{% if fido2_keys %}
@@ -98,6 +98,28 @@
Add key +
+

Active Sessions

+
+
+
+ + + + + + + + {% for session in active_sessions %} + + + + + {% endfor %} + +
IP AddressDelete
{{ session['ip_address'] }}
+
+