fix: admin panel resiste a fallimento cookie CSRF
Local Build and Deploy / deploy (push) Failing after 34s
Local Build and Deploy / deploy (push) Failing after 34s
Il layout admin non deve crashare se cookies().set() fallisce (__Host-/Secure dietro proxy). Fallback su csrf-token, meta solo con token valido. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
2de3696993
commit
557138e40b
2 files changed
+98
-22
No files matched your search
@@ -23,7 +23,12 @@ export default async function AdminLayout({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const staff = await requireStaff();
|
||||
const csrfToken = await setCsrfCookie();
|
||||
let csrfToken = "";
|
||||
try {
|
||||
csrfToken = await setCsrfCookie();
|
||||
} catch {
|
||||
csrfToken = "";
|
||||
}
|
||||
if (await siteSettings.getBool("force_staff_2fa", false)) {
|
||||
const u = await prisma.user
|
||||
.findUnique({
|
||||
@@ -36,7 +41,9 @@ export default async function AdminLayout({
|
||||
|
||||
return (
|
||||
<>
|
||||
<meta name="csrf-token" content={csrfToken} />
|
||||
{csrfToken ? (
|
||||
<meta name="csrf-token" content={csrfToken} />
|
||||
) : null}
|
||||
<AdminMobileWrapper sidebar={<Sidebar staff={staff} />}>
|
||||
<div
|
||||
data-admin
|
||||
|
||||
Reference in new issue
Block a user