mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
feat(onboarding): gate landing, auth and dashboard routes behind onboarding cookie
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { currentUser } from "@/lib/auth/current-user";
|
||||
import { isOnboardingDone } from "@/features/onboarding/onboarding-cookie";
|
||||
import { AuthLogoSection } from "@/features/auth/auth-logo-section";
|
||||
import { Heart } from "lucide-react";
|
||||
|
||||
@@ -9,6 +10,10 @@ export default async function Layout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
if (!(await isOnboardingDone())) {
|
||||
redirect("/welcome");
|
||||
}
|
||||
|
||||
const user = await currentUser();
|
||||
|
||||
if (user && !user.banned && user.role !== "pending") {
|
||||
|
||||
@@ -5,11 +5,16 @@ import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
||||
import { AppSidebar } from "@/features/layout/app-sidebar";
|
||||
import { Header } from "@/features/layout/header";
|
||||
import { currentUser } from "@/lib/auth/current-user";
|
||||
import { isOnboardingDone } from "@/features/onboarding/onboarding-cookie";
|
||||
import { ThemeMetaUpdater } from "@/features/theme/theme-meta-updater";
|
||||
import { ModeToggle } from "@/features/theme/mode-toggle";
|
||||
import { UpdateNotification } from "@/features/updates/update-notification";
|
||||
|
||||
export default async function Layout({ children }: { children: ReactNode }) {
|
||||
if (!(await isOnboardingDone())) {
|
||||
redirect("/welcome");
|
||||
}
|
||||
|
||||
const user = await currentUser();
|
||||
if (!user) redirect("/login");
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { getCurrentOrganizationSlug } from "@/features/organizations/organization-cookie";
|
||||
import { currentUser } from "@/lib/auth/current-user";
|
||||
import { isOnboardingDone } from "@/features/onboarding/onboarding-cookie";
|
||||
|
||||
export default async function Index() {
|
||||
if (!(await isOnboardingDone())) {
|
||||
redirect("/welcome");
|
||||
}
|
||||
|
||||
const user = await currentUser();
|
||||
if (user) {
|
||||
const currentOrganizationSlug = await getCurrentOrganizationSlug();
|
||||
|
||||
Reference in New Issue
Block a user