Skip to content

Scheduling infrastructure for absolutely everyone.

Fix Impersonation Refresh Bug (#5679)

sean-brydon93a14b190e8b
diff --git a/apps/web/pages/settings/admin/impersonation.tsx b/apps/web/pages/settings/admin/impersonation.tsx
index 8ab2f39a730..993d37ba53a 100644
--- a/apps/web/pages/settings/admin/impersonation.tsx
+++ b/apps/web/pages/settings/admin/impersonation.tsx
@@ -16,9 +16,7 @@ function AdminView() {
onSubmit={(e) => {
e.preventDefault();
const enteredUsername = usernameRef.current?.value.toLowerCase();
- signIn("impersonation-auth", { username: enteredUsername }).then((res) => {
- console.log(res);
- });
+ signIn("impersonation-auth", { username: enteredUsername });
}}>
<div className="flex items-center space-x-2">
<TextField
diff --git a/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx b/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx
index ba8cc74f0f1..89f8e25587a 100644
--- a/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx
+++ b/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx
@@ -1,8 +1,7 @@
import { useSession } from "next-auth/react";
-import { Trans } from "next-i18next";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { Alert } from "@calcom/ui";
+import { TopBanner } from "@calcom/ui";
function ImpersonatingBanner() {
const { t } = useLocale();
@@ -11,21 +10,17 @@ function ImpersonatingBanner() {
if (!data?.user.impersonatedByUID) return null;
return (
- <Alert
- severity="warning"
- title={
- <>
- {t("impersonating_user_warning", { user: data.user.username })}{" "}
- <Trans i18nKey="impersonating_stop_instructions">
- <a href="/auth/logout" className="underline">
- Click Here To stop
- </a>
- .
- </Trans>
- </>
- }
- className="mx-4 mb-2 sm:mx-6 md:mx-8"
- />
+ <>
+ <TopBanner
+ text={t("impersonating_user_warning", { user: data.user.username })}
+ variant="warning"
+ actions={
+ <a className="border-b border-b-black" href="/auth/logout">
+ Click Here To stop
+ </a>
+ }
+ />
+ </>
);
}
diff --git a/packages/ui/v2/core/layouts/AdminLayout.tsx b/packages/ui/v2/core/layouts/AdminLayout.tsx
index 0f2ff143217..1dcd4b9208c 100644
--- a/packages/ui/v2/core/layouts/AdminLayout.tsx
+++ b/packages/ui/v2/core/layouts/AdminLayout.tsx
@@ -17,7 +17,7 @@ export default function AdminLayout({
// Force redirect on component level
useEffect(() => {
if (session.data && session.data.user.role !== UserPermissionRole.ADMIN) {
- router.replace("/settings");
+ router.replace("/settings/my-account/profile");
}
}, [session, router]);