Fix user deletion

An improper check causes problems when trying to delete a user. This fixes that error.

(cherry picked from commit 3c838cc0e4a2d4904d0fc919fb88c58ebd4fe4bd)
This commit is contained in:
Thomas M Steenholdt 2018-06-07 15:26:54 -02:00
parent ccec6c37b4
commit 90f08ee92e

View File

@ -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)