add list users

This commit is contained in:
maaa 2023-06-29 23:32:17 +02:00
parent 379584a83f
commit 30575bcf20
1 changed files with 21 additions and 0 deletions

21
main
View File

@ -269,6 +269,27 @@ def remove(postid):
else:
return redirect("/login")
@app.route("/listusers", methods=("GET", "POST"))
def listusers():
usersession = request.cookies.get("session_DO_NOT_SHARE")
if usersession:
userCookie = get_session(usersession)
user = get_user(userCookie["id"])
if str(user["administrator"]) == "1":
thing = ""
conn = get_db_connection()
users = conn.execute("SELECT * FROM users").fetchall()
conn.close()
for x in users:
thing = str(x["id"]) + " - " + x["username"] + "<br>" + thing
return thing
else:
return "nice try"
else:
return redirect("/login")
@app.route("/settings/logout", methods=("GET", "POST"))
def logout():