Skip to content

fix(settings): hide profile 2FA and delete account when AUTH_TYPE=SSO - #14

Closed
jawad-khan wants to merge 2 commits into
foss-mainfrom
jawad/hide-delete-or-mfa-option
Closed

fix(settings): hide profile 2FA and delete account when AUTH_TYPE=SSO#14
jawad-khan wants to merge 2 commits into
foss-mainfrom
jawad/hide-delete-or-mfa-option

Conversation

@jawad-khan

Copy link
Copy Markdown
Collaborator

Summary

  • Hide the Two Factor Authentication section on the Profile settings page when AUTH_TYPE=SSO.
  • Hide the Danger zone (delete account / leave workspace) section under the same condition.
  • Extract profile 2FA UI into ProfileTwoFactorAuthenticationSection, following the same outer/inner SSO guard pattern used by Toggle2FA and SettingsTwoFactorAuthenticationMethod.

Why

In SSO deployments, MFA and account lifecycle are owned by the identity provider. Showing Twenty's local TOTP setup and self-service account deletion on Profile is misleading — those controls don't participate in the actual login or provisioning flow.

This aligns Profile with existing SSO behavior:

  • Email is already read-only under SSO
  • Password change is already hidden under SSO
  • Workspace-level 2FA enforcement toggle is already hidden under SSO
  • Direct navigation to the 2FA setup page already redirects to Profile under SSO

Test plan

  • With AUTH_TYPE=SSO, open Settings → Profile and confirm Two Factor Authentication and Danger zone are not shown
  • With AUTH_TYPE unset or non-SSO, confirm both sections still appear
  • With AUTH_TYPE=SSO, navigate directly to /settings/two-factor-authentication/totp and confirm redirect to Profile still works

@jawad-khan

Copy link
Copy Markdown
Collaborator Author

@copilot

Copilot AI commented May 21, 2026

Copy link
Copy Markdown

@copilot

All code-related CI jobs are passing ✅. The only failure is Preview Environment Dispatch — it fails because the GH_TOKEN needed to call gh api repos/twentyhq/ci-privileged/dispatches is not configured as a secret in this fork. This is a pre-existing infrastructure issue unrelated to the code changes here.

The PR changes look correct — ProfileTwoFactorAuthenticationSection guards the 2FA section behind isSsoEnabled, and DeleteAccount is wrapped with !isSsoEnabled in SettingsProfile.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Profile settings page UI to better match SSO deployments by removing local-account security and lifecycle controls that don’t apply when authentication is owned by an external IdP.

Changes:

  • Extracted the Profile “Two Factor Authentication” UI into a dedicated ProfileTwoFactorAuthenticationSection component with an outer/inner SSO guard pattern.
  • Hid the Profile “Danger zone” (delete account / leave workspace) section when AUTH_TYPE=SSO.
  • Simplified SettingsProfile by removing inline TOTP status/link logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/twenty-front/src/pages/settings/SettingsProfile.tsx Uses useIsSsoEnabled() to hide the delete/leave section under SSO and delegates Profile 2FA rendering to the new extracted component.
packages/twenty-front/src/modules/settings/profile/components/ProfileTwoFactorAuthenticationSection.tsx New component that renders the Profile TOTP card when not SSO, and returns null under SSO (outer/inner guard).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +21
export const ProfileTwoFactorAuthenticationSection = () => {
const isSsoEnabled = useIsSsoEnabled();

if (isSsoEnabled) {
return null;
}

return <ProfileTwoFactorAuthenticationSectionInner />;
};
@jawad-khan jawad-khan closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants