feat: Add more info to admin user
All checks were successful
Build Docker / Build Docker (push) Successful in 27s

This commit is contained in:
Nathan Woodburn 2024-06-14 16:39:58 +10:00
parent 6eab11e168
commit 78209641b7
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 20 additions and 1 deletions

View File

@ -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():

View File

@ -98,8 +98,11 @@
<a href="{{ url_for('.logout') }}" class="button">Log Out</a>
{% for client in clients %}
<pre>
<strong>Client Info</strong>
{% if user.id == 1 %}
<strong>client_owner: </strong>{{ client.user_id }}{% endif %}
{%- for key in client.client_info %}
<strong>{{ key }}: </strong>{{ client.client_info[key] }}
{%- endfor %}
@ -110,6 +113,19 @@
</pre>
<hr>
{% endfor %}
<br>
{% if user.id == 1 %}
{% for user_tmp in users %}
<pre>
<strong>User Info</strong>
{%- for key in user_tmp %}
<strong>{{ key }}: </strong>{{ user_tmp[key] }}
{%- endfor %}
</pre>
<hr>
{% endfor %}
{% endif %}
<br><br>
<p>Want to implement OAuth?<br>