Login, user in datenbank und encryption key
This commit is contained in:
@@ -15,6 +15,7 @@ from .PyqcrmFlags import PyqcrmFlags
|
||||
|
||||
|
||||
|
||||
|
||||
class ConfigLoader(QObject):
|
||||
__config = None
|
||||
__version = "0.1-alpha"
|
||||
@@ -22,6 +23,7 @@ class ConfigLoader(QObject):
|
||||
|
||||
dbConnectionError = Signal(str, bool)
|
||||
adminUserError = Signal(str, bool)
|
||||
usernameNotAvailable = Signal()
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -46,7 +48,10 @@ class ConfigLoader(QObject):
|
||||
@Slot(dict, result= bool)
|
||||
def addAdminUser(self, user_config):
|
||||
admin = UserManager(user_config["user"], PyqcrmFlags.ADMIN).createUser()
|
||||
return True
|
||||
print (admin)
|
||||
if not admin:
|
||||
self.usernameNotAvailable.emit()
|
||||
return admin
|
||||
|
||||
@Slot(dict, result= bool)
|
||||
def setConfig(self, app_config):
|
||||
@@ -93,12 +98,21 @@ class ConfigLoader(QObject):
|
||||
return False
|
||||
|
||||
def __checkAdminUser(self):
|
||||
con = DbManager().getConnection()
|
||||
cur = con.cursor()
|
||||
cur.callproc("checkAdmin")
|
||||
result = cur.fetchall()
|
||||
if not result:
|
||||
#if not result[0][0] == 1:
|
||||
self.adminUserError.emit("Kein Admin vorhanden", False)
|
||||
else:
|
||||
self.adminUserError.emit("Admin vorhanden", True)
|
||||
|
||||
self.adminUserError.emit("Kein Admin vorhanden", False)
|
||||
|
||||
@Slot(str)
|
||||
def setEncyrptKey(self, key):
|
||||
self.__config['pyqcrm']['ENCRYPTION_KEY'] = key
|
||||
print(self.__config)
|
||||
self.__saveConfig()
|
||||
|
||||
def __saveConfig(self):
|
||||
|
||||
Reference in New Issue
Block a user