From 419d4d40752adb97e9c3eab2f971cadb10160a95 Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Mon, 14 Jul 2025 16:33:37 +0200
Subject: [PATCH] change check for valid community_uuid
---
backend/src/federation/authenticateCommunities.ts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/backend/src/federation/authenticateCommunities.ts b/backend/src/federation/authenticateCommunities.ts
index 150c32092..2227f2c13 100644
--- a/backend/src/federation/authenticateCommunities.ts
+++ b/backend/src/federation/authenticateCommunities.ts
@@ -30,16 +30,16 @@ export async function startCommunityAuthentication(
logger.debug('homeFedComA', new FederatedCommunityLoggingView(homeFedComA))
const comB = await DbCommunity.findOneByOrFail({ publicKey: fedComB.publicKey })
logger.debug('started with comB:', new CommunityLoggingView(comB))
- // check if communityUuid is a valid v4Uuid and not still a temporary onetimecode
+ // check if communityUuid is not a valid v4Uuid
try {
if (
comB &&
((comB.communityUuid === null && comB.authenticatedAt === null) ||
(comB.communityUuid !== null &&
- validateUUID(comB.communityUuid) &&
- versionUUID(comB.communityUuid) === 4))
+ (!validateUUID(comB.communityUuid) ||
+ versionUUID(comB.communityUuid!) !== 4)))
) {
- logger.debug('comB.uuid is null or is a valid v4Uuid...', comB.communityUuid || 'null', comB.authenticatedAt || 'null')
+ logger.debug('comB.uuid is null or is a not valid v4Uuid...', comB.communityUuid || 'null', comB.authenticatedAt || 'null')
const client = AuthenticationClientFactory.getInstance(fedComB)
if (client instanceof V1_0_AuthenticationClient) {
@@ -66,7 +66,7 @@ export async function startCommunityAuthentication(
}
}
} else {
- logger.debug(`comB.communityUuid is not a valid v4Uuid or still a temporary onetimecode`, comB.communityUuid || 'null', comB.authenticatedAt || 'null')
+ logger.debug(`comB.communityUuid is already a valid v4Uuid ${ comB.communityUuid || 'null' } and was authenticated at ${ comB.authenticatedAt || 'null'}`)
}
} catch (err) {
logger.error(`Error:`, err)