mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Appease the linter
This commit is contained in:
parent
cda7b59a12
commit
bf6d0d0368
@ -98,7 +98,7 @@ class Users_Controller:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def add_user(username, password, email="default@example.com", enabled: bool = True, superuser: bool = False):
|
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)
|
return users_helper.add_user(username, password=password, email=email, enabled=enabled, superuser=superuser)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_rawpass_user(username, password, email="default@example.com", enabled: bool = True, superuser: bool = False):
|
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)
|
return users_helper.add_rawpass_user(username, password=password, email=email, enabled=enabled, superuser=superuser)
|
||||||
|
@ -161,7 +161,7 @@ class helper_users:
|
|||||||
Users.created: helper.get_time_as_string()
|
Users.created: helper.get_time_as_string()
|
||||||
}).execute()
|
}).execute()
|
||||||
return user_id
|
return user_id
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_rawpass_user(username: str, password: str = None, email: Optional[str] = None, enabled: bool = True, superuser: bool = False) -> str:
|
def add_rawpass_user(username: str, password: str = None, email: Optional[str] = None, enabled: bool = True, superuser: bool = False) -> str:
|
||||||
user_id = Users.insert({
|
user_id = Users.insert({
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
from app.classes.controllers.users_controller import users_helper
|
from app.classes.controllers.users_controller import users_helper
|
||||||
from app.classes.shared.main_controller import Controller
|
from app.classes.shared.main_controller import Controller
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class import3:
|
class import3:
|
||||||
|
|
||||||
def __init__(self):
|
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 there is only one server to import json needs to call the data differently
|
||||||
if isinstance(json_data, list):
|
if isinstance(json_data, list):
|
||||||
for server in json_data:
|
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}")
|
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}")
|
logger.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}")
|
||||||
else:
|
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}")
|
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}")
|
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()
|
@ -42,7 +42,7 @@ class PublicHandler(BaseHandler):
|
|||||||
'lang_page': helper.getLangPage(helper.get_setting('language')),
|
'lang_page': helper.getLangPage(helper.get_setting('language')),
|
||||||
'query': ""
|
'query': ""
|
||||||
}
|
}
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
page_data['query'] = self.request.query
|
page_data['query'] = self.request.query
|
||||||
|
|
||||||
# sensible defaults
|
# sensible defaults
|
||||||
@ -66,7 +66,7 @@ class PublicHandler(BaseHandler):
|
|||||||
|
|
||||||
# if we have no page, let's go to login
|
# if we have no page, let's go to login
|
||||||
else:
|
else:
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
self.redirect('/public/login?'+self.request.query)
|
self.redirect('/public/login?'+self.request.query)
|
||||||
else:
|
else:
|
||||||
self.redirect('/public/login')
|
self.redirect('/public/login')
|
||||||
@ -90,7 +90,7 @@ class PublicHandler(BaseHandler):
|
|||||||
'lang_page': helper.getLangPage(helper.get_setting('language')),
|
'lang_page': helper.getLangPage(helper.get_setting('language')),
|
||||||
'query': ""
|
'query': ""
|
||||||
}
|
}
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
page_data['query'] = self.request.query
|
page_data['query'] = self.request.query
|
||||||
|
|
||||||
if page == 'login':
|
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())
|
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()
|
next_page = self.request.query_arguments.get('next')[0].decode()
|
||||||
else:
|
else:
|
||||||
next_page = "/panel/dashboard"
|
next_page = "/panel/dashboard"
|
||||||
@ -165,7 +165,7 @@ class PublicHandler(BaseHandler):
|
|||||||
else:
|
else:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}')
|
self.redirect(f'/public/login?error_msg={error_msg}')
|
||||||
else:
|
else:
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
self.redirect('/public/login?'+self.request.query)
|
self.redirect('/public/login?'+self.request.query)
|
||||||
else:
|
else:
|
||||||
self.redirect('/public/login')
|
self.redirect('/public/login')
|
||||||
|
Loading…
Reference in New Issue
Block a user