From 036b1da9a13fd764280af2dc9ebf7684935cf6a5 Mon Sep 17 00:00:00 2001 From: Brandon Davis Date: Tue, 29 Oct 2024 08:59:03 -0500 Subject: [PATCH] Delete user (#123) --- kobodl/app.py | 10 ++++++++++ kobodl/templates/users.j2 | 5 +++++ pyproject.toml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/kobodl/app.py b/kobodl/app.py index 002d394..ca7cfce 100644 --- a/kobodl/app.py +++ b/kobodl/app.py @@ -41,6 +41,16 @@ def users(): return render_template('users.j2', users=users, error=error) +@app.route('/user//remove', methods=['POST']) +def deleteUser(userid): + user = Globals.Settings.UserList.getUser(userid) + if not user: + abort(404) + Globals.Settings.UserList.users.remove(user) + Globals.Settings.Save() + return redirect('/user') + + @app.route('/user//book', methods=['GET']) def getUserBooks(userid, error=None, success=None): user = Globals.Settings.UserList.getUser(userid) diff --git a/kobodl/templates/users.j2 b/kobodl/templates/users.j2 index 749b6f0..0752193 100644 --- a/kobodl/templates/users.j2 +++ b/kobodl/templates/users.j2 @@ -18,6 +18,11 @@ books + +
+ +
+ {% endfor %} diff --git a/pyproject.toml b/pyproject.toml index 461fe2d..3b6d9b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ multi_line_output = 3 [tool.poetry] name = "kobodl" -version = "0.9.3" +version = "0.9.4" description = "Kobo Book Downloader" authors = ["Brandon Davis "] license = "Unlicense"