From 805f51ffb23f6b10bf4217507af4f51b408caee7 Mon Sep 17 00:00:00 2001 From: luukas Date: Sun, 4 Apr 2021 21:22:52 +0300 Subject: [PATCH] One big bug slapping commit Fix bug where arguments would not have default values and would break editing users (panel handler line 507, 508 and 559), fix major typo (panel handler line 569) and fix autobleach logging (base handler lines 35 and 36) --- app/classes/web/base_handler.py | 3 ++- app/classes/web/panel_handler.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/classes/web/base_handler.py b/app/classes/web/base_handler.py index ca39d199..04b0bd3a 100644 --- a/app/classes/web/base_handler.py +++ b/app/classes/web/base_handler.py @@ -32,7 +32,8 @@ class BaseHandler(tornado.web.RequestHandler): def autobleach(self, name, text): for r in self.redactables: if r in name: - logger.debug("Auto-bleaching {}: {}".format(name, "[**REDACTED* c,mmvkkkkkkkkkkkkkkkkkkkkkkkkn*]")) + logger.debug("Auto-bleaching {}: {}".format(name, "[**REDACTED**]")) + break else: logger.debug("Auto-bleaching {}: {}".format(name, text)) if type(text) in self.nobleach: diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 7966be48..65347e33 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -504,8 +504,8 @@ class PanelHandler(BaseHandler): username = bleach.clean(self.get_argument('username', None)) password0 = bleach.clean(self.get_argument('password0', None)) password1 = bleach.clean(self.get_argument('password1', None)) - enabled = int(float(bleach.clean(self.get_argument('enabled'), '0'))) - regen_api = int(float(bleach.clean(self.get_argument('regen_api', '0')))) + enabled = int(float(self.get_argument('enabled', '0'))) + regen_api = int(float(self.get_argument('regen_api', '0'))) if not exec_user['superuser']: self.redirect("/panel/error?error=Unauthorized access: not superuser") @@ -556,7 +556,7 @@ class PanelHandler(BaseHandler): username = bleach.clean(self.get_argument('username', None)) password0 = bleach.clean(self.get_argument('password0', None)) password1 = bleach.clean(self.get_argument('password1', None)) - enabled = int(float(bleach.clean(self.get_argument('enabled'), '0'))) + enabled = int(float(self.get_argument('enabled', '0'))) if not exec_user['superuser']: self.redirect("/panel/error?error=Unauthorized access: not superuser") @@ -566,7 +566,7 @@ class PanelHandler(BaseHandler): return else: # does this user id exist? - if db_helper.get_userid_by_name(username) is not None: + if db_helper.get_user_id_by_name(username) is not None: self.redirect("/panel/error?error=User exists") return