diff --git a/src/app/(portal)/layout.tsx b/src/app/(portal)/layout.tsx deleted file mode 100644 index 4965394..0000000 --- a/src/app/(portal)/layout.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import "../globals.css"; -import { Providers } from "../providers"; - -const inter = Inter({ subsets: ["latin", "latin-ext"] }); - -export const metadata: Metadata = { - title: "Portal Tiurbe — ArchiTools", - description: "Portal extern — documente RGI si harta cadastrala", -}; - -export default function PortalLayout({ - children, -}: { - children: React.ReactNode; -}) { - return ( - - - -
- {children} -
-
- - - ); -} diff --git a/src/app/(portal)/portal/page.tsx b/src/app/(portal)/portal/page.tsx index d5aee9e..bd1b91d 100644 --- a/src/app/(portal)/portal/page.tsx +++ b/src/app/(portal)/portal/page.tsx @@ -1477,7 +1477,7 @@ function HartaContent() { export default function PortalPage() { return ( -
+
{/* Header */}
diff --git a/src/middleware.ts b/src/middleware.ts index 0157535..5605d0f 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -12,8 +12,20 @@ export async function middleware(request: NextRequest) { secret: process.env.NEXTAUTH_SECRET, }); - // Authenticated — allow through + // Authenticated — check for portal-only users if (token) { + const { pathname } = request.nextUrl; + // Portal-only users: redirect to /portal when accessing main app + const portalUsers = ["dan.tiurbe", "tiurbe"]; + const tokenEmail = String(token.email ?? "").toLowerCase(); + const tokenName = String(token.name ?? "").toLowerCase(); + const isPortalUser = portalUsers.some( + (u) => tokenEmail.includes(u) || tokenName.includes(u), + ); + if (isPortalUser && !pathname.startsWith("/portal") && !pathname.startsWith("/api/") && !pathname.startsWith("/auth/")) { + const baseUrl = process.env.NEXTAUTH_URL || "https://tools.beletage.ro"; + return NextResponse.redirect(new URL("/portal", baseUrl)); + } return NextResponse.next(); }