Recovery in Settings and start with OfferTable

This commit is contained in:
2025-03-07 11:59:51 +01:00
parent e81407b43d
commit b414a050be
13 changed files with 333 additions and 100 deletions

View File

@@ -41,6 +41,7 @@ class ConfigLoader(QObject):
else:
config_dir.mkdir(0o750, True, True)
@Slot(dict, result = bool)
def setConfig(self, app_config):
# print(f"In {__file__} file, setConfig()")
@@ -110,18 +111,13 @@ class ConfigLoader(QObject):
self.backupEncryptionKey.emit()
return admin
"""###################################################"""
""" """
""" TODO: Rename method and rename self.__encrypt_key """
""" """
"""###################################################"""
@Slot(str, str)
def saveRecoveryKey(self, recovery_file, recovery_password):
# print(f"In {__file__} file, saveRecoveryKey()")
def __saveData(self, recovery_file, recovery_password, data):
# print(f"In {__file__} file, __saveData()")
local = False
rp = self.__setRecoveryPassword(recovery_password)
rf = rp[1] + self.__encrypt_key + rp[0]
rf = rp[1] + data + rp[0]
rf = Vermasseln().oscarVermasseln(rf, local)
rec_file = urlparse(recovery_file)
if os.name == "nt":
@@ -197,7 +193,8 @@ class ConfigLoader(QObject):
if ek:
self.__config = toml.loads(ek)
self.__saveConfig()
self.configurationReady.emit()
self.__configLoad()
else:
self.invalidEncryptionKey.emit()
except Exception as e:
@@ -242,6 +239,10 @@ class ConfigLoader(QObject):
@Slot(str, str)
def backupConfig(self, filename, password):
self.__encrypt_key = toml.dumps(self.getConfig())
self.saveRecoveryKey(filename, password)
conf_file = toml.dumps(self.getConfig())
self.__saveData(filename, password, conf_file)
@Slot(str, str)
def backupEncryptkey(self, filename, password):
encrypt_key = self.__config['pyqcrm']['ENCRYPTION_KEY']
self.__saveData(filename, password, encrypt_key)