From c4492a3072af9af720656f6a945ccfe3e9fc2452 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 31 Mar 2026 20:35:04 +0800 Subject: [PATCH] fix(api-clients): fallback api-key hashing without argon2; show site/module parent display names --- backend/app/security/api_client_auth.py | 6 +++++- frontend/src/pages/admin/ModulesPage.vue | 9 ++++++++- frontend/src/pages/admin/SitesPage.vue | 9 ++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/backend/app/security/api_client_auth.py b/backend/app/security/api_client_auth.py index c51b6f6..1f6681c 100644 --- a/backend/app/security/api_client_auth.py +++ b/backend/app/security/api_client_auth.py @@ -14,7 +14,11 @@ pwd_context = CryptContext(schemes=["argon2", "bcrypt"], deprecated="auto") def hash_api_key(plain_key: str) -> str: - return pwd_context.hash(plain_key) + try: + return pwd_context.hash(plain_key) + except Exception: + # Fallback for environments missing argon2 backend. + return f"sha256:{hashlib.sha256(plain_key.encode('utf-8')).hexdigest()}" def _verify_api_key(plain_key: str, stored_hash: str) -> bool: diff --git a/frontend/src/pages/admin/ModulesPage.vue b/frontend/src/pages/admin/ModulesPage.vue index 336467b..db5b1dd 100644 --- a/frontend/src/pages/admin/ModulesPage.vue +++ b/frontend/src/pages/admin/ModulesPage.vue @@ -18,7 +18,9 @@ - + + + @@ -217,5 +219,10 @@ async function openRelations(row, tab) { } } +function getSystemName(systemKey) { + const system = systems.value.find(s => s.system_key === systemKey) + return system ? system.name : systemKey +} + onMounted(load) diff --git a/frontend/src/pages/admin/SitesPage.vue b/frontend/src/pages/admin/SitesPage.vue index 1eb2285..1b89b21 100644 --- a/frontend/src/pages/admin/SitesPage.vue +++ b/frontend/src/pages/admin/SitesPage.vue @@ -11,7 +11,9 @@ - + + + @@ -120,6 +122,11 @@ function openEdit(row) { showEditDialog.value = true } +function getCompanyName(companyKey) { + const company = companies.value.find(c => c.company_key === companyKey) + return company ? company.name : companyKey +} + function resetEditForm() { editForm.value = { site_key: '', company_key: '', name: '', status: 'active' } }