diff --git a/hub/exports/user_factory.py b/hub/exports/user_factory.py index 0c932418..68a3324d 100644 --- a/hub/exports/user_factory.py +++ b/hub/exports/user_factory.py @@ -4,8 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2022 Concordia CERC group Project CoderPeter Yefi peteryefi@gmail.com """ -from hub.persistence import UserRepo - +from hub.persistence import User class UserFactory: """ @@ -13,7 +12,7 @@ class UserFactory: """ def __init__(self, db_name, app_env, dotenv_path): - self._user_repo = UserRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path) + self._user_repo = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path) def login_user(self, email: str, password: str): """ diff --git a/hub/imports/user_factory.py b/hub/imports/user_factory.py index 3d900c1f..f4954189 100644 --- a/hub/imports/user_factory.py +++ b/hub/imports/user_factory.py @@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2022 Concordia CERC group Project CoderPeter Yefi peteryefi@gmail.com """ -from hub.persistence import UserRepo +from hub.persistence import User from hub.persistence import UserRoles @@ -14,7 +14,7 @@ class UserFactory: """ def __init__(self, db_name, app_env, dotenv_path): - self._user_repo = UserRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path) + self._user_repo = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path) def create_user(self, name: str, email: str, password: str, role: UserRoles): """ diff --git a/hub/persistence/repositories/user.py b/hub/persistence/repositories/user.py index dfa797d6..9504cc6c 100644 --- a/hub/persistence/repositories/user.py +++ b/hub/persistence/repositories/user.py @@ -114,7 +114,8 @@ class User(Repository): ).first() if user: if Auth.check_password(password, user[0].password): - return user[0] - return {'message': 'invalid login information'} + #return user[0] + return True + return False except SQLAlchemyError as err: logger.error(f'Error while fetching user by email: {err}') diff --git a/setup.py b/setup.py index c65667e9..615adc67 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ setup( 'hub.imports', 'hub.imports.construction', 'hub.imports.construction.helpers', - 'hub.imports.construction.data_classes', + #'hub.imports.construction.data_classes', 'hub.imports.energy_systems', 'hub.imports.geometry', 'hub.imports.geometry.citygml_classes', @@ -87,23 +87,23 @@ setup( ('hub/config', glob.glob('hub/config/*.ini')), ('hub/catalog_factories/greenery/ecore_greenery', glob.glob('hub/catalog_factories/greenery/ecore_greenery/*.ecore')), ('hub/data/construction.', glob.glob('hub/data/construction/*')), - ('hub/data/customized_imports/', glob.glob('hub/data/customized_imports/*.xml')), - ('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.xml')), - ('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.insel')), - ('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.xlsx')), - ('hub/data/energy_systems/*', glob.glob('hub/data/energy_systems/*.txt')), - ('hub/data/energy_systems/*', glob.glob('hub/data/energy_systems/*.yaml')), - ('hub/data/greenery/', glob.glob('hub/data/greenery/*.xml')), - ('hub/data/life_cycle_assessment/', glob.glob('hub/data/life_cycle_assessment/*.xml')), - ('hub/data/schedules/', glob.glob('hub/data/schedules/*.xml')), - ('hub/data/schedules/', glob.glob('hub/data/schedules/*.xlsx')), - ('hub/data/schedules/idf_files/', glob.glob('hub/data/schedules/idf_files/*.idf')), - ('hub/data/sensors/', glob.glob('hub/data/sensors/*.json')), - ('hub/data/usage/', glob.glob('hub/data/usage/*.xml')), - ('hub/data/usage/', glob.glob('hub/data/usage/*.xlsx')), - ('hub/data/weather/', glob.glob('hub/data/weather/*.dat')), - ('hub/data/weather/epw/', glob.glob('hub/data/weather/epw/*.epw')), - ('hub/data/weather/', glob.glob('hub/data/weather/*.dat')), + ('hub/data/customized_imports', glob.glob('hub/data/customized_imports/*.xml')), + ('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.xml')), + ('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.insel')), + ('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.xlsx')), + ('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.txt')), + ('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.yaml')), + ('hub/data/greenery', glob.glob('hub/data/greenery/*.xml')), + ('hub/data/life_cycle_assessment', glob.glob('hub/data/life_cycle_assessment/*.xml')), + ('hub/data/schedules', glob.glob('hub/data/schedules/*.xml')), + ('hub/data/schedules', glob.glob('hub/data/schedules/*.xlsx')), + ('hub/data/schedules/idf_files', glob.glob('hub/data/schedules/idf_files/*.idf')), + ('hub/data/sensors', glob.glob('hub/data/sensors/*.json')), + ('hub/data/usage', glob.glob('hub/data/usage/*.xml')), + ('hub/data/usage', glob.glob('hub/data/usage/*.xlsx')), + ('hub/data/weather', glob.glob('hub/data/weather/*.dat')), + ('hub/data/weather/epw', glob.glob('hub/data/weather/epw/*.epw')), + ('hub/data/weather', glob.glob('hub/data/weather/*.dat')), ('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idf')), ('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idd')), ('hub/helpers/data', glob.glob('hub/helpers/data/quebec_to_hub.json'))