Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(signup): restore 'Team Invite' attribution source for invited users
Devin AIb924cb5a78d2
diff --git a/backend/src/server/routes/v3/signup-router.ts b/backend/src/server/routes/v3/signup-router.tsindex c6666abaf8..033dae9d54 100644--- a/backend/src/server/routes/v3/signup-router.ts+++ b/backend/src/server/routes/v3/signup-router.ts@@ -128,7 +128,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {if (!userAgent) throw new Error("user agent header is required");const appCfg = getConfig();- const { user, accessToken, refreshToken, authMethod, organizationId } =+ const { user, accessToken, refreshToken, authMethod, organizationId, isInvitedUser } =await server.services.signup.completeAccount({...req.body,ip: req.realIp,@@ -140,13 +140,14 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {void server.services.telemetry.sendLoopsEvent(user.email, user.firstName || "", user.lastName || "");void server.services.telemetry.sendHubSpotSignupEvent(user.email,- authMethod,+ isInvitedUser ? "invite" : authMethod,user.firstName || "",user.lastName || "",req.body.hubspotUtk);}+ const bodyAttributionSource = "attributionSource" in req.body ? req.body.attributionSource : undefined;void server.services.telemetry.sendPostHogEvents({event: PostHogEventTypes.UserSignedUp,distinctId: user.username ?? "",@@ -154,7 +155,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {properties: {username: user.username,email: user.email ?? "",- attributionSource: "attributionSource" in req.body ? req.body.attributionSource : undefined+ attributionSource: isInvitedUser ? "Team Invite" : bodyAttributionSource}});diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.tsindex c3de2cb32f..808a831488 100644--- a/backend/src/services/auth/auth-signup-service.ts+++ b/backend/src/services/auth/auth-signup-service.ts@@ -171,6 +171,7 @@ export const authSignupServiceFactory = ({// whether the request is valid. This prevents timing-based user/alias enumeration.let authMethod: AuthMethod;let organizationId: string | undefined;+ let isInvitedUser = false;if (dto.type === CompleteAccountType.Email) {// Determine rejection before hashing, but don't throw yetconst shouldReject = !user || user.isAccepted || Boolean(decodedToken?.aliasId);@@ -197,7 +198,7 @@ export const authSignupServiceFactory = ({},{ tx });- const isInvitedUser = existingMemberships.length > 0;+ isInvitedUser = existingMemberships.length > 0;if (!isInvitedUser && dto.organizationName) {const org = await orgService.createOrganization({@@ -296,7 +297,8 @@ export const authSignupServiceFactory = ({accessToken: tokens.access,refreshToken: tokens.refresh,authMethod,- organizationId+ organizationId,+ isInvitedUser};};