fix issue with database path falling back to faulty path
update logic in welcome wizard, add checks for qapplication instance
This commit is contained in:
@@ -5,7 +5,6 @@ import loguru
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
from src import LOG_DIR, Icon
|
||||
from src.backend.admin_console import AdminCommands
|
||||
from src.backend.database import Database
|
||||
|
||||
from .dialog_sources.login_ui import Ui_Dialog
|
||||
@@ -51,6 +50,7 @@ class LoginDialog(Ui_Dialog):
|
||||
self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
|
||||
self.lineEdit_2.setClearButtonEnabled(True)
|
||||
self.lineEdit_2.setObjectName("lineEdit_2")
|
||||
log.info("Calling database")
|
||||
self.db = Database()
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
@@ -75,6 +75,8 @@ class LoginDialog(Ui_Dialog):
|
||||
|
||||
hashed_password = hashlib.sha256(password.encode()).hexdigest()
|
||||
if len(self.db.getUsers()) == 0:
|
||||
from src.backend.admin_console import AdminCommands
|
||||
|
||||
AdminCommands().create_admin()
|
||||
self.lresult = 1 # Indicate successful login
|
||||
self.lusername = username
|
||||
|
||||
Reference in New Issue
Block a user