add list users
This commit is contained in:
parent
379584a83f
commit
30575bcf20
21
main
21
main
|
@ -269,6 +269,27 @@ def remove(postid):
|
||||||
else:
|
else:
|
||||||
return redirect("/login")
|
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"))
|
@app.route("/settings/logout", methods=("GET", "POST"))
|
||||||
def logout():
|
def logout():
|
||||||
|
|
Reference in New Issue