mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-22 02:55:04 -05:00
fix: user existence checks in session object (#1587)
This commit is contained in:
committed by
GitHub
parent
536e610895
commit
27b99d9761
@@ -11,7 +11,7 @@ import { AuthorizationError } from "@formbricks/types/errors";
|
||||
|
||||
export default async function EnvironmentLayout({ children, params }) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session) {
|
||||
if (!session || !session.user) {
|
||||
return redirect(`/auth/login`);
|
||||
}
|
||||
const hasAccess = await hasUserEnvironmentAccess(session.user.id, params.environmentId);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { getProfile } from "@formbricks/lib/profile/service";
|
||||
export default async function ProfileSettingsPage({ params }: { params: { environmentId: string } }) {
|
||||
const { environmentId } = params;
|
||||
const session = await getServerSession(authOptions);
|
||||
const profile = session ? await getProfile(session.user.id) : null;
|
||||
const profile = session && session.user ? await getProfile(session.user.id) : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user