From 90f08ee92e690b4c11e52a4297cf8184e37c0a9c Mon Sep 17 00:00:00 2001 From: Thomas M Steenholdt Date: Thu, 7 Jun 2018 15:26:54 -0200 Subject: [PATCH] Fix user deletion An improper check causes problems when trying to delete a user. This fixes that error. (cherry picked from commit 3c838cc0e4a2d4904d0fc919fb88c58ebd4fe4bd) --- app/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views.py b/app/views.py index e453f6c..78f03b1 100644 --- a/app/views.py +++ b/app/views.py @@ -1098,9 +1098,9 @@ def admin_manageuser(): data = jdata['data'] if jdata['action'] == 'delete_user': - if username == current_user.username: - return make_response(jsonify( { 'status': 'error', 'msg': 'You cannot delete yourself.' } ), 400) user = User(username=data) + if user.username == current_user.username: + return make_response(jsonify( { 'status': 'error', 'msg': 'You cannot delete yourself.' } ), 400) result = user.delete() if result: history = History(msg='Delete username {0}'.format(data), created_by=current_user.username)