import { GetServerSidePropsContext } from "next"; import { signIn } from "next-auth/react"; import { useRef } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import Button from "@calcom/ui/Button"; import { TextField } from "@calcom/ui/form/fields"; import { getSession } from "@lib/auth"; import SettingsShell from "@components/SettingsShell"; import Shell from "@components/Shell"; function AdminView() { const { t } = useLocale(); const usernameRef = useRef(null!); return (
{ e.preventDefault(); const enteredUsername = usernameRef.current.value.toLowerCase(); signIn("impersonation-auth", { username: enteredUsername }).then((res) => { console.log(res); }); }}> {process.env.NEXT_PUBLIC_WEBSITE_URL}/ } ref={usernameRef} defaultValue={undefined} />

{t("impersonate_user_tip")}


); } export default function Admin() { const { t } = useLocale(); return ( ); } export const getServerSideProps = async (context: GetServerSidePropsContext) => { const session = await getSession(context); if (!session?.user?.id || session.user.role !== "ADMIN") { return { redirect: { permanent: false, destination: "/settings/profile" } }; } return { props: {} }; };