diff --git a/backend/src/db/migrations/20240718170955_add-access-secret-sharing.ts b/backend/src/db/migrations/20240718170955_add-access-secret-sharing.ts index eb053cf80..705c8d986 100644 --- a/backend/src/db/migrations/20240718170955_add-access-secret-sharing.ts +++ b/backend/src/db/migrations/20240718170955_add-access-secret-sharing.ts @@ -8,7 +8,7 @@ export async function up(knex: Knex): Promise { const hasColumn = await knex.schema.hasColumn(TableName.SecretSharing, "accessType"); if (!hasColumn) { await knex.schema.table(TableName.SecretSharing, (table) => { - table.string("accessType", 20).notNullable().defaultTo(SecretSharingAccessType.Anyone); + table.string("accessType").notNullable().defaultTo(SecretSharingAccessType.Anyone); }); } } diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts index a4e95af49..ca6da24e1 100644 --- a/backend/src/services/secret-sharing/secret-sharing-service.ts +++ b/backend/src/services/secret-sharing/secret-sharing-service.ts @@ -137,7 +137,7 @@ export const secretSharingServiceFactory = ({ } await secretSharingDAL.updateById(sharedSecretId, { $decr: { expiresAfterViews: 1 } }); } - if (sharedSecret.accessType === SecretSharingAccessType.Organization) { + if (sharedSecret.accessType === SecretSharingAccessType.Organization && orgId === sharedSecret.orgId) { return { ...sharedSecret, orgName }; } return { ...sharedSecret, orgName: undefined }; diff --git a/frontend/src/views/ShareSecretPublicPage/components/SecretTable.tsx b/frontend/src/views/ShareSecretPublicPage/components/SecretTable.tsx index 60849b93b..f2218be65 100644 --- a/frontend/src/views/ShareSecretPublicPage/components/SecretTable.tsx +++ b/frontend/src/views/ShareSecretPublicPage/components/SecretTable.tsx @@ -32,7 +32,9 @@ export const SecretTable = ({ orgName }: Props) => { const [isVisible, setIsVisible] = useToggle(false); - const title = (

Someone from {orgName} organization has shared a secret with you

); + const title = orgName + ? (

Someone from {orgName} organization has shared a secret with you

) + : (

You need to be logged in to view this secret

); return (
@@ -60,7 +62,7 @@ export const SecretTable = ({ onClick={() => {}} rightIcon={} > - Login to view this secret + Login into {orgName} to view this secret