Refactor authentication system: replace NextAuth with custom login/logout/session handling, improve cookie management, and enhance error handling
Build and Push Reader Image / docker (push) Successful in 39s

This commit is contained in:
2026-04-24 01:53:32 +07:00
parent 690a2fbd51
commit 7c4404ded8
26 changed files with 368 additions and 239 deletions
+2 -9
View File
@@ -1,6 +1,4 @@
import { redirect } from "next/navigation"
import { getServerSession } from "next-auth/next"
import { authOptions } from "@/lib/auth"
import { requireModSessionUser } from "@/lib/server-auth"
import { CollapsibleSidebar } from "./collapsible-sidebar"
export default async function ModLayout({
@@ -8,12 +6,7 @@ export default async function ModLayout({
}: {
children: React.ReactNode
}) {
const session = await getServerSession(authOptions)
// Kiểm tra quyền
if (!session || (session.user.role !== "MOD" && session.user.role !== "ADMIN")) {
redirect("/") // Không đủ quyền, đưa về trang chủ
}
await requireModSessionUser()
return (
<div className="flex min-h-[calc(100vh-3.5rem)] bg-muted/20">