fix: user is already part of a team (#20774)
* better error message * redirect to login if no user session * fixup * remove callback url since the same function is used by org and platform both * remove extra exclamation mark * implement PR feedback
This commit is contained in:
1 parent
02fb7c0ae0
commit
7dbfc1b2e0
4 files changed
+46
-14
No files matched your search
@@ -1,4 +1,11 @@
|
||||
import { _generateMetadata } from "app/_utils";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
import ManagedUsersView from "~/settings/platform/managed-users/managed-users-view";
|
||||
|
||||
@@ -11,7 +18,14 @@ export const generateMetadata = async () =>
|
||||
"/settings/platform/managed-users"
|
||||
);
|
||||
|
||||
const ServerPageWrapper = () => {
|
||||
const ServerPageWrapper = async () => {
|
||||
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
|
||||
const callbackUrl = `${WEBAPP_URL}/settings/platform/managed-users`;
|
||||
|
||||
if (!session?.user) {
|
||||
redirect(`/login?callbackUrl=${callbackUrl}`);
|
||||
}
|
||||
|
||||
return <ManagedUsersView />;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import { withAppDirSsr } from "app/WithAppDirSsr";
|
||||
import type { PageProps } from "app/_types";
|
||||
import { _generateMetadata } from "app/_utils";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
||||
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
|
||||
import { getServerSideProps } from "@lib/settings/organizations/new/getServerSideProps";
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
import LegacyPage, { LayoutWrapper } from "~/settings/platform/new/create-new-view";
|
||||
|
||||
type Props = {
|
||||
isOrg: boolean;
|
||||
};
|
||||
|
||||
export const generateMetadata = async () =>
|
||||
await _generateMetadata(
|
||||
(t) => t("set_up_your_platform_organization"),
|
||||
@@ -23,10 +19,14 @@ export const generateMetadata = async () =>
|
||||
"/settings/platform/new"
|
||||
);
|
||||
|
||||
const getData = withAppDirSsr<Props>(getServerSideProps);
|
||||
const ServerPage = async () => {
|
||||
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
|
||||
const callbackUrl = `${WEBAPP_URL}/settings/platform/new`;
|
||||
|
||||
if (!session?.user) {
|
||||
redirect(`/login?callbackUrl=${callbackUrl}`);
|
||||
}
|
||||
|
||||
const ServerPage = async ({ params, searchParams }: PageProps) => {
|
||||
await getData(buildLegacyCtx(await headers(), await cookies(), await params, await searchParams));
|
||||
return (
|
||||
<LayoutWrapper>
|
||||
<LicenseRequired>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { _generateMetadata } from "app/_utils";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
import PlatformPlansView from "~/settings/platform/plans/platform-plans-view";
|
||||
|
||||
@@ -12,7 +19,14 @@ export const generateMetadata = async () => {
|
||||
);
|
||||
};
|
||||
|
||||
const ServerPageWrapper = () => {
|
||||
const ServerPageWrapper = async () => {
|
||||
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
|
||||
const callbackUrl = `${WEBAPP_URL}/settings/platform/plans`;
|
||||
|
||||
if (!session?.user) {
|
||||
redirect(`/login?callbackUrl=${callbackUrl}`);
|
||||
}
|
||||
|
||||
return <PlatformPlansView />;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user