Fix Impersonation Refresh Bug (#5679)
Co-authored-by: Peer Richelsen <peeroke@gmail.com>pull/5675/head^2
parent
2a6dc340df
commit
93a14b190e
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue