From d3e830c59a44754dcf908d02eea08c76bdc4eb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 18 Apr 2021 16:07:41 +0200 Subject: [PATCH] minor changes to authenticator --- server/authentication.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/authentication.py b/server/authentication.py index 9ddc19b..a6de72e 100644 --- a/server/authentication.py +++ b/server/authentication.py @@ -1,10 +1,12 @@ -import os, sys +import json +import logging +import os +import shutil +import sys from base64 import b64encode + from Crypto.Hash import SHA256 from Crypto.Protocol.KDF import bcrypt, bcrypt_check -import json -import shutil -import logging auth_logger = logging.getLogger('AUTH APPLICATION ') auth_logger.root.setLevel(logging.INFO) @@ -30,7 +32,7 @@ class Authetication: json.dump(data, outfile) def login(self, username: str, password: str) -> str: - with open(Authetication.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: + with open(self.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: data = json.load(json_file) for user in data['user']: @@ -46,7 +48,7 @@ class Authetication: return user['homeDir'] def checkUserExists(self, username: str) -> bool: - with open(Authetication.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: + with open(self.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: data = json.load(json_file) for user in data['user']: @@ -67,7 +69,7 @@ class Authetication: b64pwd = b64encode(SHA256.new(bytePass).digest()) bcrypt_hash = bcrypt(b64pwd, 12) - with open(Authetication.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: + with open(self.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file: data = json.load(json_file) user = {