From 4019f0365e145dc09eb47bf6cac0e766e4924e80 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Mon, 13 Jun 2022 14:45:01 -0400 Subject: [PATCH 1/3] Fix user import issues --- app/classes/shared/import3.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/classes/shared/import3.py b/app/classes/shared/import3.py index d3ef7a91..e690cc29 100644 --- a/app/classes/shared/import3.py +++ b/app/classes/shared/import3.py @@ -38,9 +38,12 @@ class Import3: # If there is only one user to import json needs to call the data differently if isinstance(json_data, list): for user in json_data: - HelperUsers.add_rawpass_user(user["username"], user["password"]) - Console.info(f"Imported user {user['username']} from Crafty 3") - logger.info(f"Imported user {user['username']} from Crafty 3") + if not str(user["username"]).lower() == "admin": + HelperUsers.add_rawpass_user(user["username"], user["password"]) + Console.info(f"Imported user {user['username']} from Crafty 3") + logger.info(f"Imported user {user['username']} from Crafty 3") + else: + logger.info("Cannot create duplicate Admin account...skipping.") else: Console.info( "There is only one user detected. " From 8f5cdbb0c5b5c82db08ef9d64d090df211b6d34f Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Mon, 13 Jun 2022 15:07:12 -0400 Subject: [PATCH 2/3] Fix crafty3 -4 import users --- app/classes/shared/import3.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/app/classes/shared/import3.py b/app/classes/shared/import3.py index e690cc29..1d0cc373 100644 --- a/app/classes/shared/import3.py +++ b/app/classes/shared/import3.py @@ -45,14 +45,21 @@ class Import3: else: logger.info("Cannot create duplicate Admin account...skipping.") else: - Console.info( - "There is only one user detected. " - "Cannot create duplicate Admin account." - ) - logger.info( - "There is only one user detected. " - "Cannot create duplicate Admin account." - ) + if not str(json_data["username"]).lower() == "admin": + HelperUsers.add_rawpass_user( + json_data["username"], json_data["password"] + ) + Console.info(f"Imported user {json_data['username']} from Crafty 3") + logger.info(f"Imported user {json_data['username']} from Crafty 3") + else: + Console.info( + "There is only one user detected. " + "Cannot create duplicate Admin account." + ) + logger.info( + "There is only one user detected. " + "Cannot create duplicate Admin account." + ) def import_servers(self, json_data, controller): # If there is only one server to import json needs to call the data differently From 074e9f33a8974207389ced016b32189cc3332eb5 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Mon, 13 Jun 2022 15:14:41 -0400 Subject: [PATCH 3/3] Fix import3 --- app/classes/shared/import3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/classes/shared/import3.py b/app/classes/shared/import3.py index 1d0cc373..c04e0ae8 100644 --- a/app/classes/shared/import3.py +++ b/app/classes/shared/import3.py @@ -38,14 +38,14 @@ class Import3: # If there is only one user to import json needs to call the data differently if isinstance(json_data, list): for user in json_data: - if not str(user["username"]).lower() == "admin": + if str(user["username"]).lower() != "admin": HelperUsers.add_rawpass_user(user["username"], user["password"]) Console.info(f"Imported user {user['username']} from Crafty 3") logger.info(f"Imported user {user['username']} from Crafty 3") else: logger.info("Cannot create duplicate Admin account...skipping.") else: - if not str(json_data["username"]).lower() == "admin": + if str(json_data["username"]).lower() != "admin": HelperUsers.add_rawpass_user( json_data["username"], json_data["password"] )