diff --git a/immagini/Home.jpg b/immagini/Home.jpg new file mode 100644 index 0000000..e2950c3 Binary files /dev/null and b/immagini/Home.jpg differ diff --git a/public/Home.jpg b/public/Home.jpg new file mode 100644 index 0000000..e2950c3 Binary files /dev/null and b/public/Home.jpg differ diff --git a/public/images/Home.jpg b/public/images/Home.jpg new file mode 100644 index 0000000..e2950c3 Binary files /dev/null and b/public/images/Home.jpg differ diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 0416bb7..a1932f8 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -1,15 +1,28 @@ -export default function MainLayout({ +import { redirect } from "next/navigation"; + +import { auth } from "@/src/auth"; +import SignOutButton from "@/src/components/auth/SignOutButton"; +import Navbar from "@/src/components/Navbar"; + +export default async function MainLayout({ children, }: { children: React.ReactNode; }) { + const session = await auth(); + + if (!session?.user) { + redirect("/login"); + } + return (
+ } />

Sono del layout (main)

{children}
); -} \ No newline at end of file +} diff --git a/src/app/(management)/layout.tsx b/src/app/(management)/layout.tsx index 86ed8b5..c6d9bf4 100644 --- a/src/app/(management)/layout.tsx +++ b/src/app/(management)/layout.tsx @@ -1,6 +1,8 @@ import { redirect } from "next/navigation"; import { auth } from "@/src/auth"; +import SignOutButton from "@/src/components/auth/SignOutButton"; +import Navbar from "@/src/components/Navbar"; export default async function ManagementLayout({ children, @@ -15,6 +17,7 @@ export default async function ManagementLayout({ return (
+ } />
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 63d412f..01fa0ff 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,5 @@ import type { Metadata } from "next"; import { Inter, JetBrains_Mono } from "next/font/google"; -import { auth } from "@/src/auth"; -import SignOutButton from "@/src/components/auth/SignOutButton"; -import Navbar from "../components/Navbar"; import "./globals.css"; /** Stesse variabili CSS di globals.css; Geist non รจ disponibile in next/font su Next 14. */ @@ -26,15 +23,12 @@ export default async function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - const session = await auth(); - return (

Sono del layout root

- {session?.user ? } /> : null} {children} diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index d4c310d..40d7e0d 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -1,3 +1,4 @@ +import Image from "next/image"; import { AuthError } from "next-auth"; import { redirect } from "next/navigation"; @@ -52,51 +53,64 @@ export default async function LoginPage({ searchParams }: LoginPageProps) { const hasError = params?.error === "CredentialsSignin"; return ( -
-
-
+
+
+
+ MagRicambi +
+ +
+

Accesso

Entra in MagRicambi con utente o email.

+
+ + {hasError ? ( +

+ Credenziali non valide oppure utente non attivo. +

+ ) : null} + +
+ + + + + +
- - {hasError ? ( -

- Credenziali non valide oppure utente non attivo. -

- ) : null} - -
- - - - - -
);