Show admin password top banner (#6226)
* Invalid-admin fake role * Reset password link + shell
This commit is contained in:
@@ -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;
|
||||
Vendored
+1
-1
@@ -16,6 +16,6 @@ declare module "next-auth" {
|
||||
impersonatedByUID?: number;
|
||||
belongsToActiveTeam?: boolean;
|
||||
username?: PrismaUser["username"];
|
||||
role?: PrismaUser["role"];
|
||||
role?: PrismaUser["role"] | "INACTIVE_ADMIN";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 />}
|
||||
|
||||
Reference in New Issue
Block a user