Rollout 2FA (#14023)

Rolling out the 2FA feature for all users.
This commit is contained in:
Weiko
2025-08-21 14:31:24 +02:00
committed by GitHub
parent b9b5f9a347
commit 1c5f8c3db5
8 changed files with 26 additions and 61 deletions
@@ -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'
@@ -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'
@@ -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>
@@ -10,11 +10,9 @@ import { ProfilePictureUploader } from '@/settings/profile/components/ProfilePic
import { 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>
@@ -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: {
@@ -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',
}
@@ -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;
@@ -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,