Final refactor

Dev
This commit is contained in:
BarsTiger
2022-02-21 22:42:22 +02:00
parent 085dacae2a
commit 955bf18326
5 changed files with 52 additions and 20 deletions

View File

@@ -1,4 +1,6 @@
import json
import sys
import modules.vars as horsy_vars
import ctypes
@@ -33,6 +35,22 @@ def get_auth(is_gui=False, login_ui=None, Ui_LoginWindow=None):
login_ui.login_button.clicked.connect(load_login_now)
def get_auth_without_login(is_gui=False):
with open(horsy_vars.horsypath + 'config.cfg') as f:
config = json.load(f)
try:
if config['auth']:
return config['auth']
else:
raise Exception('No auth found')
except:
ctypes.windll.user32.MessageBoxW(0, "Login not found. Please, use the login button on account tab. "
"horsy will close now, but you don't need to restart it later",
"No auth", 0)
sys.exit(0)
def get_gui_auth(login_ui, Ui_LoginWindow):
with open(horsy_vars.horsypath + 'config.cfg') as f:
config = json.load(f)