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)
This commit is contained in:
luukas 2021-04-04 21:22:52 +03:00
parent 1e2abff40a
commit 805f51ffb2
2 changed files with 6 additions and 5 deletions

View File

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

View File

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