From 413a2c06a40c6f82bfd8a53b9e43dd33305b0dd6 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sun, 3 Apr 2022 15:54:23 -0500 Subject: [PATCH] explicitly set these not so there's no guessing --- app/accounts.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/accounts.py b/app/accounts.py index d8a76b3..16d38e4 100644 --- a/app/accounts.py +++ b/app/accounts.py @@ -61,15 +61,17 @@ def edit_gm_level(id): @gm_level(3) def lock(id): account = Account.query.filter(Account.id == id).first() - account.locked = not account.locked - account.active = account.locked - account.save() - if account.locked: + if not account.locked: + account.locked = True + account.active = False log_audit(f"Locked ({account.id}){account.username}") flash("Locked Account", "danger") else: + account.locked = False + account.active = True log_audit(f"Unlocked ({account.id}){account.username}") flash("Unlocked account", "success") + account.save() return redirect(request.referrer if request.referrer else url_for("main.index")) @@ -80,13 +82,18 @@ def ban(id): account = Account.query.filter(Account.id == id).first() account.banned = not account.banned account.active = account.banned - account.save() - if account.banned: + + if not account.banned: + account.banned = True + account.active = False log_audit(f"Banned ({account.id}){account.username}") flash("Banned Account", "danger") else: + account.banned = False + account.active = True log_audit(f"Unbanned ({account.id}){account.username}") flash("Unbanned account", "success") + account.save() return redirect(request.referrer if request.referrer else url_for("main.index"))