Skip to content

Commit

Permalink
Delete user (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
subdavis authored Oct 29, 2024
1 parent 23ddd73 commit 036b1da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions kobodl/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def users():
return render_template('users.j2', users=users, error=error)


@app.route('/user/<userid>/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/<userid>/book', methods=['GET'])
def getUserBooks(userid, error=None, success=None):
user = Globals.Settings.UserList.getUser(userid)
Expand Down
5 changes: 5 additions & 0 deletions kobodl/templates/users.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<td class="border px-4 p-1">
<a href="/user/{{ user.UserKey }}/book" class="text-blue-700">books</a>
</td>
<td class="border px-4 p-1 cursor-pointer">
<form method="POST" action="/user/{{ user.UserKey }}/remove">
<input type="submit" value="Delete User" class="cursor-pointer">
</form>
</td>
</tr>
{% endfor %}
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
license = "Unlicense"
Expand Down

0 comments on commit 036b1da

Please sign in to comment.