events updated
This commit is contained in:
@@ -38,7 +38,12 @@ from api_services import (
|
||||
|
||||
from api_configs import ApiStatic, Auth
|
||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from api_objects import (
|
||||
OccupantToken,
|
||||
CompanyToken,
|
||||
EmployeeTokenObject,
|
||||
OccupantTokenObject,
|
||||
)
|
||||
from api_library.date_time_actions.date_functions import system_arrow
|
||||
|
||||
from databases.no_sql_models.login_handlers import load_user_with_erp_details
|
||||
@@ -108,8 +113,6 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
data,
|
||||
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
from api_objects import OccupantToken, CompanyToken
|
||||
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
if data.company_uu_id not in token_dict.companies_uu_id_list:
|
||||
return JSONResponse(
|
||||
@@ -436,9 +439,7 @@ class AuthenticationDisconnectUserEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def authentication_disconnect_user(
|
||||
cls,
|
||||
data: Logout,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
|
||||
cls, data: Logout, token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
|
||||
):
|
||||
found_user = Users.filter_one(Users.uu_id == token_dict.user_uu_id).data
|
||||
if not found_user:
|
||||
@@ -586,8 +587,8 @@ class AuthenticationForgotPasswordEventMethods(MethodToEvent):
|
||||
@classmethod
|
||||
def authentication_forgot_password(
|
||||
cls,
|
||||
request: Request,
|
||||
data: Forgot,
|
||||
request: Request,
|
||||
data: Forgot,
|
||||
):
|
||||
found_user: Users = Users.check_user_exits(
|
||||
access_key=data.access_key, domain=data.domain
|
||||
@@ -632,14 +633,16 @@ class AuthenticationDownloadAvatarEventMethods(MethodToEvent):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def authentication_download_avatar(
|
||||
cls, data: Forgot
|
||||
):
|
||||
def authentication_download_avatar(cls, data: Forgot):
|
||||
if found_user := Users.check_user_exits(
|
||||
access_key=data.access_key, domain=data.domain
|
||||
):
|
||||
expired_starts = str(system_arrow.now() - system_arrow.get(str(found_user.expiry_ends)))
|
||||
expired_int = int(system_arrow.now() - system_arrow.get(str(found_user.expiry_ends)).days)
|
||||
expired_starts = str(
|
||||
system_arrow.now() - system_arrow.get(str(found_user.expiry_ends))
|
||||
)
|
||||
expired_int = int(
|
||||
system_arrow.now() - system_arrow.get(str(found_user.expiry_ends)).days
|
||||
)
|
||||
return JSONResponse(
|
||||
content={
|
||||
"completed": True,
|
||||
@@ -755,4 +758,4 @@ AuthenticationDownloadAvatarEventMethod = AuthenticationDownloadAvatarEventMetho
|
||||
# is_login=False,
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
# )
|
||||
|
||||
Reference in New Issue
Block a user