Skip to content

Scheduling infrastructure for absolutely everyone.

fix: hide 2fa tab when using google as identity provider (#9333)

Udit Takkarb7b1fff1c077
diff --git a/packages/features/settings/layouts/SettingsLayout.tsx b/packages/features/settings/layouts/SettingsLayout.tsx
index 2d5a014bd22..f6a1855100a 100644
--- a/packages/features/settings/layouts/SettingsLayout.tsx
+++ b/packages/features/settings/layouts/SettingsLayout.tsx
@@ -10,6 +10,7 @@ import { classNames } from "@calcom/lib";
import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { IdentityProvider } from "@calcom/prisma/enums";
import { MembershipRole, UserPermissionRole } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import useAvatarQuery from "@calcom/trpc/react/hooks/useAvatarQuery";
@@ -51,8 +52,8 @@ const tabs: VerticalTabItemProps[] = [
icon: Key,
children: [
{ name: "password", href: "/settings/security/password" },
- { name: "2fa_auth", href: "/settings/security/two-factor-auth" },
{ name: "impersonation", href: "/settings/security/impersonation" },
+ { name: "2fa_auth", href: "/settings/security/two-factor-auth" },
],
},
{
@@ -116,6 +117,10 @@ const useTabs = () => {
tab.name = user?.name || "my_account";
tab.icon = undefined;
tab.avatar = avatar?.avatar || WEBAPP_URL + "/" + session?.data?.user?.username + "/avatar.png";
+ } else if (tab.href === "/settings/security" && user?.identityProvider === IdentityProvider.GOOGLE) {
+ tab.children = tab?.children?.filter(
+ (childTab) => childTab.href !== "/settings/security/two-factor-auth"
+ );
}
return tab;
});