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

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
pull/9338/head
Udit Takkar 2023-06-05 17:34:48 +05:30 committed by GitHub
parent 886f7021f4
commit b7b1fff1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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;
});