From 78209641b706a1bd56ce33cbb36ced6922e24a5d Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 14 Jun 2024 16:39:58 +1000 Subject: [PATCH] feat: Add more info to admin user --- website/routes.py | 5 ++++- website/templates/home.html | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/website/routes.py b/website/routes.py index baf614d..1b40806 100644 --- a/website/routes.py +++ b/website/routes.py @@ -58,11 +58,14 @@ def home(): return redirect(next_page) return redirect("/") user = current_user() + users = [] if user: clients = OAuth2Client.query.filter_by(user_id=user.id).all() if user.id == 1: clients = OAuth2Client.query.all() + users = User.query.all() + users = [{"id": user.id, "username": user.username} for user in users] if next_page: return redirect(next_page) @@ -82,7 +85,7 @@ def home(): - return render_template("home.html", user=user, clients=clients, address=address, hnsid=hnsid) + return render_template("home.html", user=user, clients=clients, address=address, hnsid=hnsid, users=users) @bp.route("/hnsid", methods=["POST"]) def hnsid(): diff --git a/website/templates/home.html b/website/templates/home.html index ce29af1..cc7066b 100644 --- a/website/templates/home.html +++ b/website/templates/home.html @@ -98,8 +98,11 @@ Log Out {% for client in clients %} +
 Client Info
+  {% if user.id == 1 %}
+  client_owner: {{ client.user_id }}{% endif %}
   {%- for key in client.client_info %}
   {{ key }}: {{ client.client_info[key] }}
   {%- endfor %}
@@ -110,6 +113,19 @@
 

{% endfor %} +
+ {% if user.id == 1 %} + {% for user_tmp in users %} + +
+User Info
+    {%- for key in user_tmp %}
+    {{ key }}: {{ user_tmp[key] }}
+    {%- endfor %}
+
+
+ {% endfor %} + {% endif %}

Want to implement OAuth?