2022-03-22 15:22:20 +00:00
|
|
|
import { IdentityProvider } from "@prisma/client";
|
2021-09-21 09:29:20 +00:00
|
|
|
import React from "react";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2022-07-28 19:58:26 +00:00
|
|
|
import SAMLConfiguration from "@calcom/features/ee/common/components/SamlConfiguration";
|
2022-04-16 02:58:34 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-07-22 17:27:06 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2022-01-13 20:05:23 +00:00
|
|
|
|
|
|
|
import { identityProviderNameMap } from "@lib/auth";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2021-09-29 21:33:18 +00:00
|
|
|
import SettingsShell from "@components/SettingsShell";
|
2021-09-21 09:29:20 +00:00
|
|
|
import ChangePasswordSection from "@components/security/ChangePasswordSection";
|
2022-05-25 15:21:18 +00:00
|
|
|
import DisableUserImpersonation from "@components/security/DisableUserImpersonation";
|
2021-09-22 19:52:38 +00:00
|
|
|
import TwoFactorAuthSection from "@components/security/TwoFactorAuthSection";
|
2021-09-21 09:29:20 +00:00
|
|
|
|
2021-10-14 10:57:49 +00:00
|
|
|
export default function Security() {
|
|
|
|
const user = trpc.useQuery(["viewer.me"]).data;
|
2021-10-12 13:11:33 +00:00
|
|
|
const { t } = useLocale();
|
2021-09-21 09:29:20 +00:00
|
|
|
return (
|
2022-05-26 17:07:14 +00:00
|
|
|
<SettingsShell heading={t("security")} subtitle={t("manage_account_security")}>
|
|
|
|
<>
|
2022-01-13 20:05:23 +00:00
|
|
|
{user && user.identityProvider !== IdentityProvider.CAL ? (
|
|
|
|
<>
|
|
|
|
<div className="mt-6">
|
2022-02-09 00:05:13 +00:00
|
|
|
<h2 className="font-cal text-lg font-medium leading-6 text-gray-900">
|
2022-01-13 20:05:23 +00:00
|
|
|
{t("account_managed_by_identity_provider", {
|
|
|
|
provider: identityProviderNameMap[user.identityProvider],
|
|
|
|
})}
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<p className="mt-1 text-sm text-gray-500">
|
|
|
|
{t("account_managed_by_identity_provider_description", {
|
|
|
|
provider: identityProviderNameMap[user.identityProvider],
|
|
|
|
})}
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
) : (
|
2022-04-16 02:58:34 +00:00
|
|
|
<div className="space-y-2 divide-y">
|
2022-01-13 20:05:23 +00:00
|
|
|
<ChangePasswordSection />
|
|
|
|
<TwoFactorAuthSection twoFactorEnabled={user?.twoFactorEnabled || false} />
|
2022-05-25 15:21:18 +00:00
|
|
|
<DisableUserImpersonation disableImpersonation={user?.disableImpersonation ?? true} />
|
2022-04-16 02:58:34 +00:00
|
|
|
</div>
|
2022-01-13 20:05:23 +00:00
|
|
|
)}
|
|
|
|
|
|
|
|
<SAMLConfiguration teamsView={false} teamId={null} />
|
2022-05-26 17:07:14 +00:00
|
|
|
</>
|
|
|
|
</SettingsShell>
|
2021-09-21 09:29:20 +00:00
|
|
|
);
|
|
|
|
}
|