Scheduling infrastructure for absolutely everyone.
Show admin password top banner (#6226)
sean-brydon6548f01efa8f
diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsxindex 39b9b75c9fd..c5f7f9bb9ed 100644--- a/apps/web/pages/api/auth/[...nextauth].tsx+++ b/apps/web/pages/api/auth/[...nextauth].tsx@@ -138,7 +138,7 @@ const providers: Provider[] = [username: user.username,email: user.email,name: user.name,- role: "USER",+ role: "INACTIVE_ADMIN",belongsToActiveTeam: hasActiveTeams,};}diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex e3d4cae92de..aa7185d81ad 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1481,5 +1481,7 @@"send_code" : "Send code","number_verified": "Number Verified","create_your_first_team_webhook_description": "Create your first webhook for this team event type",- "create_webhook_team_event_type": "Create a webhook for this team event type"+ "create_webhook_team_event_type": "Create a webhook for this team event type",+ "invalid_admin_password": "You are set as an admin but you do not have a password length of at least 15 characters",+ "change_password_admin": "Change Password to gain admin access"}diff --git a/packages/features/users/components/AdminPasswordBanner.tsx b/packages/features/users/components/AdminPasswordBanner.tsxnew file mode 100644index 00000000000..1bf42680d06--- /dev/null+++ b/packages/features/users/components/AdminPasswordBanner.tsx@@ -0,0 +1,28 @@+import { useSession } from "next-auth/react";+import Link from "next/link";++import { useLocale } from "@calcom/lib/hooks/useLocale";+import { TopBanner } from "@calcom/ui";++function AdminPasswordBanner() {+ const { t } = useLocale();+ const { data } = useSession();++ if (data?.user.role !== "INACTIVE_ADMIN") return null;++ return (+ <>+ <TopBanner+ text={t("invalid_admin_password", { user: data.user.username })}+ variant="warning"+ actions={+ <Link href="/settings/security/password">+ <a className="border-b border-b-black">{t("change_password_admin")}</a>+ </Link>+ }+ />+ </>+ );+}++export default AdminPasswordBanner;diff --git a/packages/types/next-auth.d.ts b/packages/types/next-auth.d.tsindex 94c3fba1018..8890fe50c3b 100644--- a/packages/types/next-auth.d.ts+++ b/packages/types/next-auth.d.ts@@ -16,6 +16,6 @@ declare module "next-auth" {impersonatedByUID?: number;belongsToActiveTeam?: boolean;username?: PrismaUser["username"];- role?: PrismaUser["role"];+ role?: PrismaUser["role"] | "INACTIVE_ADMIN";}}diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsxindex 12f327ebd4a..549ac0fedf1 100644--- a/packages/ui/v2/core/Shell.tsx+++ b/packages/ui/v2/core/Shell.tsx@@ -13,6 +13,7 @@ import ImpersonatingBanner from "@calcom/features/ee/impersonation/components/Imimport HelpMenuItem from "@calcom/features/ee/support/components/HelpMenuItem";import { TeamsUpgradeBanner } from "@calcom/features/ee/teams/components";import { Tips } from "@calcom/features/tips";+import AdminPasswordBanner from "@calcom/features/users/components/AdminPasswordBanner";import CustomBranding from "@calcom/lib/CustomBranding";import classNames from "@calcom/lib/classNames";import {@@ -157,6 +158,7 @@ const Layout = (props: LayoutProps) => {<div className="divide-y divide-black"><TeamsUpgradeBanner /><ImpersonatingBanner />+ <AdminPasswordBanner /></div><div className="flex flex-1" data-testid="dashboard-shell">{props.SidebarContainer || <SideBarContainer />}