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():
|
||||
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():
|
||||
|
|
Loading…
Reference in a new issue