Aktueller Stand
This commit is contained in:
14
app/page.tsx
14
app/page.tsx
@@ -2,21 +2,27 @@ import { getServerSession } from "next-auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import CalendarBoard from "../components/CalendarBoard";
|
||||
import { authOptions } from "../lib/auth";
|
||||
import { getAccessSettings } from "../lib/system-settings";
|
||||
|
||||
export default async function HomePage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
const { publicAccessEnabled } = await getAccessSettings();
|
||||
if (!session?.user && !publicAccessEnabled) {
|
||||
redirect("/login");
|
||||
}
|
||||
const isBlocked =
|
||||
session?.user &&
|
||||
(session.user.status !== "ACTIVE" || session.user.emailVerified === false);
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
{session?.user?.status === "ACTIVE" ? (
|
||||
<CalendarBoard />
|
||||
) : session?.user ? (
|
||||
{isBlocked ? (
|
||||
<div className="card-muted text-center">
|
||||
<p className="text-slate-700">
|
||||
Dein Konto wartet auf Freischaltung durch einen Admin.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
redirect("/login")
|
||||
<CalendarBoard />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user