From df454b7293bf35da505daa2b2d5daa5eaa1ff1f0 Mon Sep 17 00:00:00 2001 From: Sujan Adhikari <109404840+Sujanadh@users.noreply.github.com> Date: Fri, 6 Dec 2024 02:33:33 +0545 Subject: [PATCH] fix: odk credentials are passed without encrypting at first to avoid double encryption (#1957) --- src/backend/app/organisations/organisation_deps.py | 6 +++--- .../app/organisations/organisation_schemas.py | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/backend/app/organisations/organisation_deps.py b/src/backend/app/organisations/organisation_deps.py index cf3b81351e..6db119e028 100644 --- a/src/backend/app/organisations/organisation_deps.py +++ b/src/backend/app/organisations/organisation_deps.py @@ -85,9 +85,9 @@ async def get_org_odk_creds( ) return central_schemas.ODKCentralDecrypted( - odk_central_url=org.odk_central_url, - odk_central_user=org.odk_central_user, - odk_central_password=org.odk_central_password, + odk_central_url=url, + odk_central_user=user, + odk_central_password=password, ) diff --git a/src/backend/app/organisations/organisation_schemas.py b/src/backend/app/organisations/organisation_schemas.py index cc8f86581d..d32e3a8aff 100644 --- a/src/backend/app/organisations/organisation_schemas.py +++ b/src/backend/app/organisations/organisation_schemas.py @@ -79,20 +79,16 @@ def parse_organisation_input( The parsed data is returned as an OrganisationIn instance, with the ODKCentralIn fields merged in. """ - odk_central_data = ODKCentralIn( - odk_central_url=odk_central_url, - odk_central_user=odk_central_user, - odk_central_password=odk_central_password, - ) - org_data = OrganisationUpdate( + return OrganisationUpdate( name=name, slug=slug, created_by=created_by, community_type=community_type, type=type, - **odk_central_data.dict(exclude_unset=True), + odk_central_url=odk_central_url, + odk_central_user=odk_central_user, + odk_central_password=odk_central_password, ) - return org_data class OrganisationOut(BaseModel):