1
0
Fork 0
forked from bton/matekasse

Added confirmation to /removeuser

This commit is contained in:
2000-Trek 2023-06-14 19:48:21 +02:00
parent 218a9cb6a7
commit c5ed57a74e

View file

@ -64,13 +64,21 @@ def user_info():
def new_user():
return render_template("adduser.html")
@app.rout("/removeuser/confirmation", methods=['GET'])
def confirm_remove_user():
user_id = request.args.get("id")
return f'<a href="/removeuser?id={user_id}"></a>'
@app.route("/removeuser", methods=['GET'])
def remove_user():
user_id = request.args.get("id")
#Noch eine Bestätigung nötig
c.execute(f"SELECT * FROM users WHERE id={user_id}")
user_name = c.fetchall()[0][1]
c.execute(f"DELETE FROM tags WHERE userid={user_id}")
c.execute(f"DELETE FROM users WHERE id={user_id}")
conn.commit()
return f'<p>Deleted user {user_name}</p><a href="/list">return to the tags and user list</a>'
@app.route("/adduser/user", methods=['GET'])
def adduser():