Show admin password top banner (#6226)

* Invalid-admin fake role

* Reset password link + shell
This commit is contained in:
sean-brydon
2023-01-01 11:19:58 +00:00
committed by GitHub
parent 518a4484d6
commit 6548f01efa
5 changed files with 35 additions and 3 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ const providers: Provider[] = [
username: user.username,
email: user.email,
name: user.name,
role: "USER",
role: "INACTIVE_ADMIN",
belongsToActiveTeam: hasActiveTeams,
};
}
@@ -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"
}
@@ -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;
+1 -1
View File
@@ -16,6 +16,6 @@ declare module "next-auth" {
impersonatedByUID?: number;
belongsToActiveTeam?: boolean;
username?: PrismaUser["username"];
role?: PrismaUser["role"];
role?: PrismaUser["role"] | "INACTIVE_ADMIN";
}
}
+2
View File
@@ -13,6 +13,7 @@ import ImpersonatingBanner from "@calcom/features/ee/impersonation/components/Im
import 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 />}