forked from bton/matekasse
Added confirmation to /removeuser
This commit is contained in:
parent
218a9cb6a7
commit
c5ed57a74e
1 changed files with 8 additions and 0 deletions
8
main.py
8
main.py
|
@ -64,13 +64,21 @@ def user_info():
|
||||||
def new_user():
|
def new_user():
|
||||||
return render_template("adduser.html")
|
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'])
|
@app.route("/removeuser", methods=['GET'])
|
||||||
def remove_user():
|
def remove_user():
|
||||||
user_id = request.args.get("id")
|
user_id = request.args.get("id")
|
||||||
#Noch eine Bestätigung nötig
|
#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 tags WHERE userid={user_id}")
|
||||||
c.execute(f"DELETE FROM users WHERE id={user_id}")
|
c.execute(f"DELETE FROM users WHERE id={user_id}")
|
||||||
conn.commit()
|
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'])
|
@app.route("/adduser/user", methods=['GET'])
|
||||||
def adduser():
|
def adduser():
|
||||||
|
|
Loading…
Reference in a new issue