From 7b71c36e3ff7b34571227553ec88f75a1c55d5ff Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 28 Dec 2022 11:31:27 +0200 Subject: [PATCH] require reason for banning --- files/routes/admin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index fee5d7587..d93761aea 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -927,7 +927,11 @@ def shadowban(user_id, v): if user.admin_level > v.admin_level: abort(403) user.shadowbanned = v.id - reason = request.values.get("reason").strip()[:256] + reason = request.values.get("reason", "").strip()[:256] + + if not reason: + abort(400, "You need to submit a reason for shadowbanning!") + reason = filter_emojis_only(reason) user.ban_reason = reason g.db.add(user) @@ -1022,7 +1026,10 @@ def ban_user(user_id, v): except: pass - reason = request.values.get("reason").strip()[:256] + reason = request.values.get("reason", "").strip()[:256] + + if not reason: + abort(400, "You need to submit a reason for banning!") if reason.startswith("/") and '\\' not in reason: reason = f'{reason}'