Skip to content

Commit

Permalink
Check if user exists before deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
x10102 committed Dec 22, 2024
1 parent 48a7fe7 commit 1b858e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion blueprints/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def user(uid: int):
@UserController.route('/user/<int:uid>/delete', methods=["POST", "GET"])
@login_required
def delete_user(uid: int):
name = dbs.get_user(uid).nickname
user = dbs.get_user(uid) or abort(404)
name = user.nickname
dbs.delete_user(uid)
info(f"User {name} deleted by {current_user.nickname} (ID: {current_user.uid})")
flash(f'Uživatel {name} smazán')
Expand Down

0 comments on commit 1b858e5

Please sign in to comment.