From caae765a6e53be04fe93b5be58998f7fd36af0f1 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 14 Apr 2025 13:36:04 +0800 Subject: [PATCH] Obfuscate org invite name and slug if not logged in (#34986) --- .../OrganizationInvite/OrganizationInvite.tsx | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx index 36919e970c2..2045a71820a 100644 --- a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx +++ b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx @@ -25,8 +25,9 @@ export const OrganizationInvite = () => { ) const hasError = isError || (isSuccess && (data.token_does_not_exist || data.expired_token || !data.email_match)) + const isNotSignedInError = error?.message.includes('No authorization token was found') - const organizationName = data?.organization_name ?? name ?? 'an organization' + const organizationName = isSuccess ? data?.organization_name : 'an organization' const loginRedirectLink = `/sign-in?returnTo=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}` const { mutate: joinOrganization, isLoading: isJoining } = @@ -50,27 +51,29 @@ export const OrganizationInvite = () => {

You have been invited to join

{organizationName}

- {slug &&

{`organization slug: ${slug}`}

} + {isSuccess && slug && ( +

{`organization slug: ${slug}`}

+ )}
-
- {profile === undefined && ( -
-

- You will need to sign in to accept this invitation -

-
- - -
+ {profile === undefined && ( +
+

+ You will need to sign in to accept this invitation +

+
+ +
- )} - {hasError && ( +
+ )} +
+ {hasError && !isNotSignedInError && (