The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Rollout 2FA (#14023)
Weiko1c5f8c3db54e
diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 7cc857677b0..3666bff8613 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -962,7 +962,6 @@ export enum FeatureFlagKey {IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',IS_RELATION_CONNECT_ENABLED = 'IS_RELATION_CONNECT_ENABLED',IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',- IS_TWO_FACTOR_AUTHENTICATION_ENABLED = 'IS_TWO_FACTOR_AUTHENTICATION_ENABLED',IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',IS_WORKFLOW_BRANCH_ENABLED = 'IS_WORKFLOW_BRANCH_ENABLED',IS_WORKSPACE_MIGRATION_V2_ENABLED = 'IS_WORKSPACE_MIGRATION_V2_ENABLED'diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.tsindex c64fb138103..47983b11ffc 100644--- a/packages/twenty-front/src/generated/graphql.ts+++ b/packages/twenty-front/src/generated/graphql.ts@@ -926,7 +926,6 @@ export enum FeatureFlagKey {IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',IS_RELATION_CONNECT_ENABLED = 'IS_RELATION_CONNECT_ENABLED',IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',- IS_TWO_FACTOR_AUTHENTICATION_ENABLED = 'IS_TWO_FACTOR_AUTHENTICATION_ENABLED',IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',IS_WORKFLOW_BRANCH_ENABLED = 'IS_WORKFLOW_BRANCH_ENABLED',IS_WORKSPACE_MIGRATION_V2_ENABLED = 'IS_WORKSPACE_MIGRATION_V2_ENABLED'diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsxindex 4af6d7c83b8..f2a79cfdd96 100644--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx@@ -18,11 +18,9 @@ import {import { Card } from 'twenty-ui/layout';import {type AuthProviders,- FeatureFlagKey,useUpdateWorkspaceMutation,} from '~/generated-metadata/graphql';-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { Toggle2FA } from './Toggle2FA';const StyledSettingsSecurityOptionsList = styled.div`@@ -42,10 +40,6 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {currentWorkspaceState,);- const isTwoFactorAuthenticationEnabled = useIsFeatureEnabled(- FeatureFlagKey.IS_TWO_FACTOR_AUTHENTICATION_ENABLED,- );-const [updateWorkspace] = useUpdateWorkspaceMutation();const isValidAuthProvider = (@@ -185,11 +179,9 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {}/></Card>- {isTwoFactorAuthenticationEnabled && (- <Card rounded>- <Toggle2FA />- </Card>- )}+ <Card rounded>+ <Toggle2FA />+ </Card></>)}</StyledSettingsSecurityOptionsList>diff --git a/packages/twenty-front/src/pages/settings/SettingsProfile.tsx b/packages/twenty-front/src/pages/settings/SettingsProfile.tsxindex 8b4f00b26f2..5f7ec565413 100644--- a/packages/twenty-front/src/pages/settings/SettingsProfile.tsx+++ b/packages/twenty-front/src/pages/settings/SettingsProfile.tsx@@ -10,11 +10,9 @@ import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePicimport { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication';import { SettingsPath } from '@/types/SettingsPath';import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { H2Title, IconShield, Status } from 'twenty-ui/display';import { Section } from 'twenty-ui/layout';import { UndecoratedLink } from 'twenty-ui/navigation';-import { FeatureFlagKey } from '~/generated-metadata/graphql';import { getSettingsPath } from '~/utils/navigation/getSettingsPath';export const SettingsProfile = () => {@@ -23,10 +21,6 @@ export const SettingsProfile = () => {const { currentUserWorkspaceTwoFactorAuthenticationMethods } =useCurrentUserWorkspaceTwoFactorAuthentication();- const isTwoFactorAuthenticationEnabled = useIsFeatureEnabled(- FeatureFlagKey.IS_TWO_FACTOR_AUTHENTICATION_ENABLED,- );-const has2FAMethod =currentUserWorkspaceTwoFactorAuthenticationMethods['TOTP']?.status ==='VERIFIED';@@ -61,32 +55,30 @@ export const SettingsProfile = () => {/><EmailField /></Section>- {isTwoFactorAuthenticationEnabled && (- <Section>- <H2Title- title={t`Two Factor Authentication`}- description={t`Enhances security by requiring a code along with your password`}+ <Section>+ <H2Title+ title={t`Two Factor Authentication`}+ description={t`Enhances security by requiring a code along with your password`}+ />+ <UndecoratedLink+ to={getSettingsPath(+ SettingsPath.TwoFactorAuthenticationStrategyConfig,+ { twoFactorAuthenticationStrategy: 'TOTP' },+ )}+ >+ <SettingsCard+ title={t`Authenticator App`}+ Icon={<IconShield />}+ Status={+ has2FAMethod ? (+ <Status text={'Active'} color={'turquoise'} />+ ) : (+ <Status text={'Deactivated'} color={'gray'} />+ )+ }/>- <UndecoratedLink- to={getSettingsPath(- SettingsPath.TwoFactorAuthenticationStrategyConfig,- { twoFactorAuthenticationStrategy: 'TOTP' },- )}- >- <SettingsCard- title={t`Authenticator App`}- Icon={<IconShield />}- Status={- has2FAMethod ? (- <Status text={'Active'} color={'turquoise'} />- ) : (- <Status text={'Deactivated'} color={'gray'} />- )- }- />- </UndecoratedLink>- </Section>- )}+ </UndecoratedLink>+ </Section><Section><ChangePassword /></Section>diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.tsindex ee5fd7cb618..552a43dea1c 100644--- a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts@@ -22,15 +22,6 @@ export const PUBLIC_FEATURE_FLAGS: PublicFeatureFlag[] = ['https://twenty.com/images/lab/is-imap-smtp-caldav-enabled.png',},},- {- key: FeatureFlagKey.IS_TWO_FACTOR_AUTHENTICATION_ENABLED,- metadata: {- label: 'Two Factor Authentication',- description: 'Enable two-factor authentication for your workspace',- imagePath:- 'https://twenty.com/images/lab/is-two-factors-auth-enabled.png',- },- },{key: FeatureFlagKey.IS_FIELDS_PERMISSIONS_ENABLED,metadata: {diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.tsindex 9bc03eb8667..b5740a7ccc3 100644--- a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts@@ -12,7 +12,6 @@ export enum FeatureFlagKey {IS_FIELDS_PERMISSIONS_ENABLED = 'IS_FIELDS_PERMISSIONS_ENABLED',IS_CORE_VIEW_SYNCING_ENABLED = 'IS_CORE_VIEW_SYNCING_ENABLED',IS_CORE_VIEW_ENABLED = 'IS_CORE_VIEW_ENABLED',- IS_TWO_FACTOR_AUTHENTICATION_ENABLED = 'IS_TWO_FACTOR_AUTHENTICATION_ENABLED',IS_WORKSPACE_MIGRATION_V2_ENABLED = 'IS_WORKSPACE_MIGRATION_V2_ENABLED',IS_API_KEY_ROLES_ENABLED = 'IS_API_KEY_ROLES_ENABLED',}diff --git a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.tsindex 93270270c0f..8e0e94fb95d 100644--- a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts+++ b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts@@ -136,7 +136,6 @@ describe('WorkspaceEntityManager', () => {IS_FIELDS_PERMISSIONS_ENABLED: false,IS_CORE_VIEW_SYNCING_ENABLED: false,IS_CORE_VIEW_ENABLED: false,- IS_TWO_FACTOR_AUTHENTICATION_ENABLED: false,IS_WORKSPACE_MIGRATION_V2_ENABLED: false,IS_API_KEY_ROLES_ENABLED: false,},@@ -161,7 +160,6 @@ describe('WorkspaceEntityManager', () => {IS_RELATION_CONNECT_ENABLED: false,IS_FIELDS_PERMISSIONS_ENABLED: true,IS_CORE_VIEW_SYNCING_ENABLED: false,- IS_TWO_FACTOR_AUTHENTICATION_ENABLED: false,},permissionsPerRoleId: {},} as WorkspaceDataSource;diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.tsindex 218874b3d96..d5a80a989b8 100644--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/utils/seed-feature-flags.util.ts@@ -60,11 +60,6 @@ export const seedFeatureFlags = async (workspaceId: workspaceId,value: false,},- {- key: FeatureFlagKey.IS_TWO_FACTOR_AUTHENTICATION_ENABLED,- workspaceId: workspaceId,- value: true,- },{key: FeatureFlagKey.IS_WORKSPACE_MIGRATION_V2_ENABLED,workspaceId: workspaceId,