Commit 9fbdd464 authored by arun.uday's avatar arun.uday

AssetManager-V1.0- Yet to be reviewed

Updated the code to include new user login if the user email domain is knowledgelens. Also, added necessary validations to the code.
parent 5a7d4881
...@@ -6,14 +6,33 @@ if __name__ == "__main__": ...@@ -6,14 +6,33 @@ if __name__ == "__main__":
import uvicorn import uvicorn
from scripts.config import PROJECT_NAME, Services from scripts.config import Services
import argparse
from scripts.logging.logger import logger from scripts.logging.logger import logger
# starting the application # starting the application
ap = argparse.ArgumentParser()
if __name__ == "__main__": if __name__ == "__main__":
try: try:
print("Api for " + PROJECT_NAME) ap.add_argument(
# uvicorn run "--port",
uvicorn.run("main:app", port=int(Services.PORT)) "-p",
required=False,
default=Services.PORT,
help="Port to start the application.",
)
ap.add_argument(
"--bind",
"-b",
required=False,
default=Services.HOST,
help="IF to start the application.",
)
arguments = vars(ap.parse_args())
logger.info(f"App Starting at {arguments['bind']}:{arguments['port']}")
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
except Exception as e: except Exception as e:
logger.error(e) logger.exception(e)
[PROJECT_NAME] [PROJECT_DETAILS]
PROJECT_NAME = AssetManager PROJECT_NAME = AssetManager
PROJECT_ID = 1256
[PATH] [PATH]
base_path = scripts/ base_path = scripts/
......
...@@ -15,7 +15,7 @@ if __name__ == "__main__": ...@@ -15,7 +15,7 @@ if __name__ == "__main__":
from fastapi import FastAPI from fastapi import FastAPI
from scripts.services import router from scripts.services import router
from scripts.config import PROJECT_NAME, Services as ServiceConf from scripts.config import Services as ServiceConf
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from scripts.logging.logger import logger from scripts.logging.logger import logger
...@@ -25,7 +25,7 @@ app.include_router(router) ...@@ -25,7 +25,7 @@ app.include_router(router)
# starting the application # starting the application
if __name__ == "__main__": if __name__ == "__main__":
try: try:
print("Api for " + PROJECT_NAME) print("Api for " + ServiceConf.PROJECT_NAME)
# enabling cors for getting UI data # enabling cors for getting UI data
if ServiceConf.ENABLE_CORS: if ServiceConf.ENABLE_CORS:
app.add_middleware( app.add_middleware(
......
...@@ -5,12 +5,13 @@ from pydantic import BaseSettings, Field ...@@ -5,12 +5,13 @@ from pydantic import BaseSettings, Field
config = configparser.RawConfigParser() config = configparser.RawConfigParser()
config.read("conf/application.conf") config.read("conf/application.conf")
PROJECT_NAME = config.get("PROJECT_NAME", "PROJECT_NAME")
class _Services(BaseSettings): class _Services(BaseSettings):
HOST: str = Field(default="127.0.0.1", env="service_host") HOST: str = Field(default="127.0.0.1", env="service_host")
PORT: int = Field(default=8000, env="service_port") PORT: int = Field(default=8000, env="service_port")
PROJECT_NAME = config.get("PROJECT_DETAILS", "PROJECT_NAME")
PROJECT_ID = config.get("PROJECT_DETAILS", "PROJECT_ID")
# path # path
BASE_PATH = config.get("PATH", 'base_path') BASE_PATH = config.get("PATH", 'base_path')
SUB_PATH = config.get("PATH", "sub_path") SUB_PATH = config.get("PATH", "sub_path")
......
from __future__ import annotations from __future__ import annotations
import base64 import base64
import datetime
from Cryptodome.Cipher import AES from Cryptodome.Cipher import AES
from passlib.context import CryptContext from passlib.context import CryptContext
...@@ -9,27 +10,51 @@ from scripts.config import Services ...@@ -9,27 +10,51 @@ from scripts.config import Services
from scripts.database.mongo.mongo_login import MongoUser from scripts.database.mongo.mongo_login import MongoUser
from scripts.errors import ErrorMessages from scripts.errors import ErrorMessages
from scripts.logging.logger import logger from scripts.logging.logger import logger
from scripts.utils.mongo_default_queries import MongoQueries
class LoginHandlers: class LoginHandlers:
def __init__(self): def __init__(self):
self.mongo_user = MongoUser()
self.mongo_queries = MongoQueries()
self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
self.db_user_data = None self.db_user_data = None
self.db_user_data = None
self.dt = datetime.datetime.now()
self.time_dt = datetime.datetime.now()
@staticmethod @staticmethod
def un_pad(s): def un_pad(s):
# un_padding the encrypted password
return s[:-ord(s[len(s) - 1:])] return s[:-ord(s[len(s) - 1:])]
def new_user_login(self, login_data, password):
# check the domain of the email the user has entered
if login_data.username.split("@")[-1] == "knowledgelens.com":
# hash the password
hashed_password = self.pwd_context.hash(password)
# Enter the user as a guest user to the db
if self.mongo_user.insert_user(
self.mongo_queries.insert_user_query(
login_data,
Services.PROJECT_ID,
hashed_password,
self.time_dt)):
return True
return False
def password_decrypt(self, password): def password_decrypt(self, password):
try: try:
# encoding the Key # encoding the Key
key = Services.KEY_ENCRYPTION.encode('utf-8') key = Services.KEY_ENCRYPTION.encode('utf-8')
# decoding the received password # decoding the received password
enc = base64.b64decode(password) enc = base64.b64decode(password)
# mode for the decryption
mode = AES.MODE_CBC
# getting the initialization vector # getting the initialization vector
iv = enc[:AES.block_size] iv = enc[:AES.block_size]
# decoding with AES # decoding with AES
cipher = AES.new(key, AES.MODE_CBC, iv) cipher = AES.new(key, mode, iv)
# decoding the password # decoding the password
data = cipher.decrypt(enc[AES.block_size:]) data = cipher.decrypt(enc[AES.block_size:])
if len(data) == 0: if len(data) == 0:
...@@ -53,29 +78,40 @@ class LoginHandlers: ...@@ -53,29 +78,40 @@ class LoginHandlers:
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
def db_data_validation(self, username): def db_data_validation(self, login_data, password):
try: try:
# fetching the data based on the username # fetching the data based on the username
self.db_user_data = MongoUser().fetch_user_details(username) self.db_user_data = MongoUser().fetch_user_details(login_data.username)
# if the user is not available # if the user is not available
if not self.db_user_data: if not self.db_user_data:
return False, {"message": ErrorMessages.ERROR_USER_NOT_REGISTERED, "data": username} # if the domain of the user email is knowledge lens create the user as a guest user
if self.new_user_login(login_data, password):
return True, {"message": "new_user", "username": login_data.username, "role": "guest"}
else:
return False, {"message": ErrorMessages.ERROR_INVALID_USERNAME,
"data": {login_data.username, login_data.password}}
# Check the project id from the request body
if self.db_user_data["project_id"] != Services.PROJECT_ID or Services.PROJECT_ID != login_data.project_id:
return False, {"message": ErrorMessages.ERROR_UNAUTHORIZED_USER_LOGIN, "data": login_data.username}
# if the user exist # if the user exist
return None, {"message": True} return None, {"message": True}
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
def db_password_matching(self, username, password): def db_password_matching(self, login_data, password):
try: try:
# getting the response after checking for the user data in db # getting the response after checking for the user data in db
response, message = self.db_data_validation(username) response, message = self.db_data_validation(login_data, password)
# if the response is false then a error message is send back if response and message["message"] == "new_user":
return None, message
# if the response is false then an error message is send back
if response is not None: if response is not None:
return response, message return response, message
# if the user exists in db then password is matched # if the user exists in db then password is matched
if not self.pwd_context.verify(password, self.db_user_data["password"]): if not self.pwd_context.verify(password, self.db_user_data["password"]):
return False, {"message": ErrorMessages.ERROR_PASSWORD_MISMATCH, "data": {"username": username}} return False, {"message": ErrorMessages.ERROR_PASSWORD_MISMATCH,
"data": {"username": login_data.username}}
# if the password is correct # if the password is correct
return None, {"username": username, "role": self.db_user_data["user_role"]} return None, {"username": login_data.username, "role": self.db_user_data["user_role"]}
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
...@@ -6,5 +6,6 @@ class ErrorMessages: ...@@ -6,5 +6,6 @@ class ErrorMessages:
ERROR_INVALID_LOGIN = "Your are not authorized to view this website." ERROR_INVALID_LOGIN = "Your are not authorized to view this website."
ERROR_INVALID_USERNAME = "Invalid Username" ERROR_INVALID_USERNAME = "Invalid Username"
ERROR_INVALID_PASSWORD = "Invalid Password" ERROR_INVALID_PASSWORD = "Invalid Password"
ERROR_UNAUTHORIZED_USER_LOGIN = "Account is not available"
ERROR_USER_NOT_REGISTERED = "Account is not registered in the portal." ERROR_USER_NOT_REGISTERED = "Account is not registered in the portal."
ERROR_PASSWORD_MISMATCH = "Passwords Authentication Failed. Please enter the correct password" ERROR_PASSWORD_MISMATCH = "Passwords Authentication Failed. Please enter the correct password"
...@@ -38,3 +38,494 @@ Traceback (most recent call last): ...@@ -38,3 +38,494 @@ Traceback (most recent call last):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret") raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None TypeError: secret must be unicode or bytes, not None
2023-03-17 18:31:50 - ERROR - [AnyIO worker thread:password_decrypt(): 35] - Incorrect padding
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 26, in password_decrypt
key = Services.KEY_ENCRYPTION.encode('utf-8')
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
2023-03-17 18:31:50 - ERROR - [AnyIO worker thread:login_default(): 30] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 22, in login_default
# validating the received inputs empty or not
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 55, in db_password_matching
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 18:32:43 - ERROR - [AnyIO worker thread:password_decrypt(): 35] - 'utf-8' codec can't decode byte 0x91 in position 4: invalid start byte
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 33, in password_decrypt
# decoding the password
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x91 in position 4: invalid start byte
2023-03-17 18:32:43 - ERROR - [AnyIO worker thread:login_default(): 30] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 22, in login_default
# validating the received inputs empty or not
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 55, in db_password_matching
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:02:51 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Length of parameter 'nonce' must be in the range 7..13 bytes
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_CCM, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_ccm.py", line 649, in _create_ccm_cipher
return CcmMode(factory, key, nonce, mac_len, msg_len,
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_ccm.py", line 145, in __init__
raise ValueError("Length of parameter 'nonce' must be"
ValueError: Length of parameter 'nonce' must be in the range 7..13 bytes
2023-03-17 19:02:52 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:02:52 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:03:23 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Too many arguments for this mode
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_CTR, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 75, in _create_cipher
raise TypeError("Too many arguments for this mode")
TypeError: Too many arguments for this mode
2023-03-17 19:03:23 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:03:23 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:03:35 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Too many arguments for this mode
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_CTR, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 75, in _create_cipher
raise TypeError("Too many arguments for this mode")
TypeError: Too many arguments for this mode
2023-03-17 19:03:35 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:03:35 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:04:13 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - IV is not meaningful for the ECB mode
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_ECB, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 77, in _create_cipher
raise TypeError("IV is not meaningful for the ECB mode")
TypeError: IV is not meaningful for the ECB mode
2023-03-17 19:04:13 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:04:13 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:04:28 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Nonce must be at most 15 bytes long
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_OCB, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_ocb.py", line 532, in _create_ocb_cipher
return OcbMode(factory, nonce, mac_len, kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_ocb.py", line 127, in __init__
raise ValueError("Nonce must be at most 15 bytes long")
ValueError: Nonce must be at most 15 bytes long
2023-03-17 19:04:28 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:04:28 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:05:11 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Incorrect key length (16 bytes)
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_SIV, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_siv.py", line 392, in _create_siv_cipher
return SivMode(factory, key, nonce, kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\_mode_siv.py", line 101, in __init__
raise ValueError("Incorrect key length (%d bytes)" % len(key))
ValueError: Incorrect key length (16 bytes)
2023-03-17 19:05:11 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:05:11 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-17 19:06:23 - ERROR - [AnyIO worker thread:password_decrypt(): 41] - Too many arguments for this mode
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 32, in password_decrypt
cipher = AES.new(key, AES.MODE_CTR, iv)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "E:\Git\meta-services\venv\lib\site-packages\Cryptodome\Cipher\__init__.py", line 75, in _create_cipher
raise TypeError("Too many arguments for this mode")
TypeError: Too many arguments for this mode
2023-03-17 19:06:23 - ERROR - [AnyIO worker thread:db_password_matching(): 81] - secret must be unicode or bytes, not None
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 76, in db_password_matching
if not self.pwd_context.verify(password, self.db_user_data["password"]):
File "E:\Git\meta-services\venv\lib\site-packages\passlib\context.py", line 2347, in verify
return record.verify(secret, hash, **kwds)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 787, in verify
validate_secret(secret)
File "E:\Git\meta-services\venv\lib\site-packages\passlib\utils\handlers.py", line 122, in validate_secret
raise exc.ExpectedStringError(secret, "secret")
TypeError: secret must be unicode or bytes, not None
2023-03-17 19:06:23 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 09:57:51 - ERROR - [MainThread:<module>(): 19] - cannot import name 'PROJECT_NAME' from 'scripts.config' (E:\Git\meta-services\scripts\config\__init__.py)
2023-03-20 10:18:10 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:33:43 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:35:04 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:35:14 - ERROR - [AnyIO worker thread:db_data_validation(): 92] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:35:14 - ERROR - [AnyIO worker thread:db_password_matching(): 108] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 97, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:35:14 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:35:41 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:35:46 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 80, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:35:46 - ERROR - [AnyIO worker thread:db_password_matching(): 109] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:35:46 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:35:58 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:36:01 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 80, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:36:01 - ERROR - [AnyIO worker thread:db_password_matching(): 109] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:36:01 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:36:21 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:36:24 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:36:24 - ERROR - [AnyIO worker thread:db_password_matching(): 109] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:36:24 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:37:38 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:37:41 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:37:41 - ERROR - [AnyIO worker thread:db_password_matching(): 111] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:37:41 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:01 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:38:05 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 80, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:38:05 - ERROR - [AnyIO worker thread:db_password_matching(): 111] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:05 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:22 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:38:26 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 80, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:38:26 - ERROR - [AnyIO worker thread:db_password_matching(): 111] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:26 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:39 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:38:41 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:38:41 - ERROR - [AnyIO worker thread:db_password_matching(): 111] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:41 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:53 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:38:58 - ERROR - [AnyIO worker thread:db_data_validation(): 93] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or \
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:38:58 - ERROR - [AnyIO worker thread:db_password_matching(): 111] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 98, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:38:58 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:39:25 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:39:28 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:41:52 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:41:55 - ERROR - [AnyIO worker thread:db_data_validation(): 91] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
if self.db_user_data["project_id"] != Services.PROJECT_ID or Services.PROJECT_ID != login_data.project_id:
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:41:55 - ERROR - [AnyIO worker thread:db_password_matching(): 109] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 96, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:41:55 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:43:17 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:43:20 - ERROR - [AnyIO worker thread:db_data_validation(): 92] - 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 79, in db_data_validation
print(self.db_user_data["project_id"], Services.PROJECT_ID, login_data.project_id)
TypeError: 'NoneType' object is not subscriptable
2023-03-20 10:43:20 - ERROR - [AnyIO worker thread:db_password_matching(): 110] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 97, in db_password_matching
response, message = self.db_data_validation(login_data)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:43:20 - ERROR - [AnyIO worker thread:login_default(): 37] - cannot unpack non-iterable NoneType object
Traceback (most recent call last):
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 27, in login_default
response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
TypeError: cannot unpack non-iterable NoneType object
2023-03-20 10:44:05 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:45:12 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:46:51 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:47:22 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:47:40 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:47:41 - ERROR - [MainThread:<module>(): 37] - invalid syntax (login_handler.py, line 104)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 35, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.login_handler import LoginHandlers
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 104
if not self.pwd_context.verify(password, self.db_user_data["password"]):
^
SyntaxError: invalid syntax
2023-03-20 10:47:46 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:47:47 - ERROR - [MainThread:<module>(): 37] - invalid syntax (login_handler.py, line 104)
Traceback (most recent call last):
File "E:\Git\meta-services\app.py", line 35, in <module>
uvicorn.run("main:app", host=arguments["bind"], port=int(arguments["port"]))
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\main.py", line 568, in run
server.run()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\server.py", line 66, in serve
config.load()
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\config.py", line 471, in load
self.loaded_app = import_from_string(self.app)
File "E:\Git\meta-services\venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Users\arun.uday\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "E:\Git\meta-services\main.py", line 17, in <module>
from scripts.services import router
File "E:\Git\meta-services\scripts\services\__init__.py", line 2, in <module>
from scripts.services import v1
File "E:\Git\meta-services\scripts\services\v1\__init__.py", line 3, in <module>
from scripts.services.v1 import iot_manager_services
File "E:\Git\meta-services\scripts\services\v1\iot_manager_services.py", line 5, in <module>
from scripts.core.handlers.login_handler import LoginHandlers
File "E:\Git\meta-services\scripts\core\handlers\login_handler.py", line 104
if not self.pwd_context.verify(password, self.db_user_data["password"]):
^
SyntaxError: invalid syntax
2023-03-20 10:48:00 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:48:28 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:50:16 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:50:34 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
2023-03-20 10:55:39 - INFO - [MainThread:<module>(): 34] - App Starting at 0.0.0.0:8671
...@@ -2,7 +2,7 @@ import logging ...@@ -2,7 +2,7 @@ import logging
import os import os
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
from scripts.config import Services, PROJECT_NAME from scripts.config import Services
def get_logger(): def get_logger():
...@@ -29,7 +29,7 @@ def get_logger(): ...@@ -29,7 +29,7 @@ def get_logger():
os.makedirs(file_path) os.makedirs(file_path)
# joining the path # joining the path
log_file = os.path.join(f"{file_path}{PROJECT_NAME}log.log") log_file = os.path.join(f"{file_path}{Services.PROJECT_NAME}log.log")
# creating rotating file handler with max byte as 1 # creating rotating file handler with max byte as 1
temp_handler = RotatingFileHandler(log_file, maxBytes=1) temp_handler = RotatingFileHandler(log_file, maxBytes=1)
......
...@@ -18,15 +18,13 @@ def login_default(login_data: NormalLogin): ...@@ -18,15 +18,13 @@ def login_default(login_data: NormalLogin):
try: try:
# decrypting the password from the UI # decrypting the password from the UI
decrypted_password = obj_login_handler.password_decrypt(login_data.password) decrypted_password = obj_login_handler.password_decrypt(login_data.password)
# validating the received inputs empty or not # validating the received inputs empty or not
response = obj_login_handler.user_data_validation(login_data.username, decrypted_password) response = obj_login_handler.user_data_validation(login_data.username, decrypted_password)
if response is not None: if response is not None:
return JSONResponse(content=DefaultFailureResponse(error=response["message"]).dict(), return JSONResponse(content=DefaultFailureResponse(error=response["message"]).dict(),
status_code=status.HTTP_400_BAD_REQUEST) status_code=status.HTTP_400_BAD_REQUEST)
# checking for the account and password matching # checking for the account and password matching
response, data = obj_login_handler.db_password_matching(login_data.username, decrypted_password) response, data = obj_login_handler.db_password_matching(login_data, decrypted_password)
if response is not None: if response is not None:
return JSONResponse(content=DefaultFailureResponse(error=data).dict(), return JSONResponse(content=DefaultFailureResponse(error=data).dict(),
status_code=status.HTTP_401_UNAUTHORIZED) status_code=status.HTTP_401_UNAUTHORIZED)
......
class MongoQueries:
@staticmethod
def insert_user_query(login_data, project_id, hashed_password, time_dt):
query = {"project_id": project_id, "name": "", "email": login_data.username,
"password": hashed_password,
"user_role": "guest",
"is_alive": True, "created_at": time_dt,
"updated_at": time_dt}
return query
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment