Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

[MISC] Create platform key before onboarding step at signup (#1990)

Chandrasekharan Mdf8e439bd635
diff --git a/backend/account_v2/authentication_controller.py b/backend/account_v2/authentication_controller.py
index cf1c245f6..f24f0e8c7 100644
--- a/backend/account_v2/authentication_controller.py
+++ b/backend/account_v2/authentication_controller.py
@@ -200,6 +200,10 @@ class AuthenticationController:
)
if new_organization:
+ self.authentication_helper.create_initial_platform_key(
+ user=user, organization=organization
+ )
+
try:
self.auth_service.frictionless_onboarding(
organization=organization, user=user
@@ -207,9 +211,6 @@ class AuthenticationController:
except MethodNotImplemented:
logger.info("frictionless_onboarding not implemented")
- self.authentication_helper.create_initial_platform_key(
- user=user, organization=organization
- )
logger.info(
f"New organization created with Id {organization_id}",
)
diff --git a/backend/account_v2/authentication_helper.py b/backend/account_v2/authentication_helper.py
index 754b97afc..adf5948d6 100644
--- a/backend/account_v2/authentication_helper.py
+++ b/backend/account_v2/authentication_helper.py
@@ -55,24 +55,6 @@ class AuthenticationHelper:
return user
def create_initial_platform_key(self, user: User, organization: Organization) -> None:
- """Create an initial platform key for the given user and organization.
-
- This method generates a new platform key with the specified parameters
- and saves it to the database. The generated key is set as active and
- assigned the name "Key #1". The key is associated with the provided
- user and organization.
-
- Parameters:
- user (User): The user for whom the platform key is being created.
- organization (Organization):
- The organization to which the platform key belongs.
-
- Raises:
- Exception: If an error occurs while generating the platform key.
-
- Returns:
- None
- """
try:
PlatformAuthenticationService.generate_platform_key(
is_active=True,
@@ -81,7 +63,7 @@ class AuthenticationHelper:
organization=organization,
)
except Exception:
- logger.error(
+ logger.exception(
"Failed to create default platform key for "
f"organization {organization.organization_id}"
)