updated login/select
This commit is contained in:
@@ -22,6 +22,7 @@ from .api_events import (
|
||||
authentication_reset_password_event,
|
||||
authentication_download_avatar_event,
|
||||
)
|
||||
from .function_handlers import AuthenticationFunctions
|
||||
|
||||
|
||||
AuthenticationLoginEventMethods = MethodToEvent(
|
||||
@@ -39,7 +40,7 @@ AuthenticationLoginEventMethods = MethodToEvent(
|
||||
|
||||
|
||||
def authentication_login_with_domain_and_creds_endpoint(
|
||||
request: Request, data: EndpointBaseRequestModel,
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
event_2_catch = AuthenticationLoginEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_login_super_user_event.key}"
|
||||
@@ -68,7 +69,9 @@ AuthenticationSelectEventMethods = MethodToEvent(
|
||||
)
|
||||
|
||||
|
||||
def authentication_select_company_or_occupant_type(data: EndpointBaseRequestModel) -> Dict[str, Any]:
|
||||
def authentication_select_company_or_occupant_type(
|
||||
request: Request, data: EndpointBaseRequestModel
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Select company or occupant type.
|
||||
"""
|
||||
@@ -76,8 +79,13 @@ def authentication_select_company_or_occupant_type(data: EndpointBaseRequestMode
|
||||
function = AuthenticationSelectEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_select_super_user_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
return function.endpoint_callable(data=data)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
data_model = None
|
||||
if context_retriever.token.is_employee:
|
||||
data_model = function.REQUEST_VALIDATOR.get('EmployeeSelection', None)(**data.data)
|
||||
elif context_retriever.token.is_occupant:
|
||||
data_model = function.REQUEST_VALIDATOR.get('OccupantSelection', None)(**data.data)
|
||||
return function.endpoint_callable(data=data_model)
|
||||
|
||||
|
||||
AuthenticationSelectEventMethods.endpoint_callable = (
|
||||
@@ -103,7 +111,7 @@ def authentication_check_token_is_valid():
|
||||
function = AuthenticationCheckTokenEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_check_token_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable()
|
||||
|
||||
|
||||
@@ -132,7 +140,7 @@ def authentication_refresh_user_info():
|
||||
function = AuthenticationRefreshEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_refresh_user_info_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable()
|
||||
|
||||
|
||||
@@ -159,7 +167,7 @@ def authentication_change_password_event_callable(data: EndpointBaseRequestModel
|
||||
function = AuthenticationChangePasswordEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_change_password_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -184,7 +192,7 @@ def authentication_create_password(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationCreatePasswordEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_create_password_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -213,7 +221,7 @@ def authentication_disconnect_user(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationDisconnectUserEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_disconnect_user_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -235,7 +243,7 @@ def authentication_logout_user(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationLogoutEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_logout_user_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -262,7 +270,7 @@ def authentication_refresher_token(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationRefreshTokenEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_refresher_token_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -290,7 +298,7 @@ def authentication_forgot_password(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationForgotPasswordEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_forgot_password_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data)
|
||||
|
||||
|
||||
@@ -319,8 +327,8 @@ def authentication_reset_password(data: EndpointBaseRequestModel):
|
||||
function = AuthenticationResetPasswordEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_reset_password_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
return function.endpoint_callable(data=data)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable(data=data.data)
|
||||
|
||||
|
||||
AuthenticationResetPasswordEventMethods.endpoint_callable = (
|
||||
@@ -348,7 +356,7 @@ def authentication_download_avatar():
|
||||
function = AuthenticationDownloadAvatarEventMethods.retrieve_event(
|
||||
event_function_code=f"{authentication_download_avatar_event.key}"
|
||||
)
|
||||
setattr(function.endpoint_callable, context_retriever.key, context_retriever.context)
|
||||
AuthenticationFunctions.context_retriever = context_retriever
|
||||
return function.endpoint_callable()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user