From b7b1fff1c0778170527dceae7f6db7a9f3ea7c2a Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Mon, 5 Jun 2023 17:34:48 +0530 Subject: [PATCH] fix: hide 2fa tab when using google as identity provider (#9333) Signed-off-by: Udit Takkar --- packages/features/settings/layouts/SettingsLayout.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/features/settings/layouts/SettingsLayout.tsx b/packages/features/settings/layouts/SettingsLayout.tsx index 2d5a014bd2..f6a1855100 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; });