1
0
Fork 0
forked from bton/matekasse

fixed error in /remove user

This commit is contained in:
2000-Trek 2023-06-14 18:54:58 +02:00
parent fda2fb6ffd
commit 6500962dc4

12
main.py
View file

@ -46,11 +46,11 @@ def list():
@app.route("/list/user", methods=['GET']) @app.route("/list/user", methods=['GET'])
def user_info(): def user_info():
username = '%s' % request.args.get("user") username = request.args.get("user")
c.execute("SELECT * FROM users WHERE username = '%s'" % username) c.execute("SELECT * FROM users WHERE username = '%s'" % username)
user = c.fetchall() user_list = c.fetchall()
if user != []: if user_list != []:
user[0] user = user_list[0]
c.execute(f"SELECT * FROM tags WHERE userid={user[0]}") c.execute(f"SELECT * FROM tags WHERE userid={user[0]}")
tags = c.fetchall() tags = c.fetchall()
text = "" text = ""
@ -66,7 +66,9 @@ def new_user():
@app.route("/removeuser", methods=['GET']) @app.route("/removeuser", methods=['GET'])
def remove_user(): def remove_user():
user_id = '%s' % request.args.get("id") user_name = request.args.get("id")
c.execute("SELECT * FROM users WHERE username = '%s'" % user_name)
user_id = c.fetchall()[0][0]
c.execute(f"DELETE * FROM tags WHERE userid={user_id}") #Noch eine Bestätigung nötig c.execute(f"DELETE * FROM tags WHERE userid={user_id}") #Noch eine Bestätigung nötig
c.execute(f"DELETE * FROM users WHERE id={user_id}") c.execute(f"DELETE * FROM users WHERE id={user_id}")
conn.commit() conn.commit()