diff --git a/app/classes/controllers/users_controller.py b/app/classes/controllers/users_controller.py index e073dc12..bd51fd8f 100644 --- a/app/classes/controllers/users_controller.py +++ b/app/classes/controllers/users_controller.py @@ -98,7 +98,7 @@ class Users_Controller: @staticmethod def add_user(username, password, email="default@example.com", enabled: bool = True, superuser: bool = False): return users_helper.add_user(username, password=password, email=email, enabled=enabled, superuser=superuser) - + @staticmethod def add_rawpass_user(username, password, email="default@example.com", enabled: bool = True, superuser: bool = False): return users_helper.add_rawpass_user(username, password=password, email=email, enabled=enabled, superuser=superuser) diff --git a/app/classes/models/users.py b/app/classes/models/users.py index 6027c2b9..751fdb1c 100644 --- a/app/classes/models/users.py +++ b/app/classes/models/users.py @@ -161,7 +161,7 @@ class helper_users: Users.created: helper.get_time_as_string() }).execute() return user_id - + @staticmethod def add_rawpass_user(username: str, password: str = None, email: Optional[str] = None, enabled: bool = True, superuser: bool = False) -> str: user_id = Users.insert({ diff --git a/app/classes/shared/import3.py b/app/classes/shared/import3.py index 0cb7ace5..db9670b7 100644 --- a/app/classes/shared/import3.py +++ b/app/classes/shared/import3.py @@ -1,12 +1,13 @@ import json import os import logging -logger = logging.getLogger(__name__) from app.classes.controllers.users_controller import users_helper from app.classes.shared.main_controller import Controller from app.classes.shared.console import console +logger = logging.getLogger(__name__) + class import3: def __init__(self): @@ -42,13 +43,15 @@ class import3: # If there is only one server to import json needs to call the data differently if isinstance(json_data, list): for server in json_data: - new_server_id = controller.import_jar_server(server_name=server['server_name'], server_path=server['server_path'], server_jar=server['server_jar'], min_mem=(int(server['memory_min'])/1000), max_mem=(int(server['memory_max'])/1000), port=server['server_port']) + new_server_id = controller.import_jar_server(server_name=server['server_name'], server_path=server['server_path'], server_jar=server['server_jar'], + min_mem=(int(server['memory_min'])/1000), max_mem=(int(server['memory_max'])/1000), port=server['server_port']) console.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}") logger.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}") else: - new_server_id = controller.import_jar_server(server_name=json_data['server_name'], server_path=json_data['server_path'], server_jar=json_data['server_jar'], min_mem=(int(json_data['memory_min'])/1000), max_mem=(int(json_data['memory_max'])/1000), port=json_data['server_port']) + new_server_id = controller.import_jar_server(server_name=json_data['server_name'], server_path=json_data['server_path'], server_jar=json_data['server_jar'], + min_mem=(int(json_data['memory_min'])/1000), max_mem=(int(json_data['memory_max'])/1000), port=json_data['server_port']) console.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}") logger.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}") -import3 = import3() +import3 = import3() \ No newline at end of file diff --git a/app/classes/web/public_handler.py b/app/classes/web/public_handler.py index 8cc2d7c2..72d2d4aa 100644 --- a/app/classes/web/public_handler.py +++ b/app/classes/web/public_handler.py @@ -42,7 +42,7 @@ class PublicHandler(BaseHandler): 'lang_page': helper.getLangPage(helper.get_setting('language')), 'query': "" } - if (self.request.query): + if self.request.query: page_data['query'] = self.request.query # sensible defaults @@ -66,7 +66,7 @@ class PublicHandler(BaseHandler): # if we have no page, let's go to login else: - if (self.request.query): + if self.request.query: self.redirect('/public/login?'+self.request.query) else: self.redirect('/public/login') @@ -90,7 +90,7 @@ class PublicHandler(BaseHandler): 'lang_page': helper.getLangPage(helper.get_setting('language')), 'query': "" } - if (self.request.query): + if self.request.query: page_data['query'] = self.request.query if page == 'login': @@ -147,7 +147,7 @@ class PublicHandler(BaseHandler): self.controller.management.add_to_audit_log(user_data.user_id, "Logged in", 0, self.get_remote_ip()) - if (self.request.query_arguments.get('next')): + if self.request.query_arguments.get('next'): next_page = self.request.query_arguments.get('next')[0].decode() else: next_page = "/panel/dashboard" @@ -165,7 +165,7 @@ class PublicHandler(BaseHandler): else: self.redirect(f'/public/login?error_msg={error_msg}') else: - if (self.request.query): + if self.request.query: self.redirect('/public/login?'+self.request.query) else: self.redirect('/public/login')