Fix login2

This commit is contained in:
Enguerrand Ozano
2026-02-28 21:16:05 +01:00
parent 65f6d1c4d6
commit 79ba505e70
2 changed files with 11 additions and 1 deletions

View File

@@ -9,9 +9,15 @@ import { Testimonials } from './payload/collections/Testimonials'
import { FAQ } from './payload/collections/FAQ'
import { Media } from './payload/collections/Media'
const serverURL = process.env.NEXT_PUBLIC_SERVER_URL || ''
export default buildConfig({
secret: process.env.PAYLOAD_SECRET || 'change-moi',
serverURL: process.env.NEXT_PUBLIC_SERVER_URL || '',
serverURL,
// csrf: Payload auto-populates from serverURL when non-empty.
// When serverURL is empty, csrf stays [] → all origins accepted (dev-safe).
// cors: Allow the public origin to call the REST API from the browser.
cors: serverURL ? [serverURL] : '*',
editor: lexicalEditor(),
routes: {
admin: '/gestion59',

View File

@@ -4,6 +4,10 @@ export const Users: CollectionConfig = {
slug: 'users',
auth: {
maxLoginAttempts: 0,
cookies: {
secure: process.env.NODE_ENV === 'production',
sameSite: 'Lax',
},
},
admin: {
useAsTitle: 'email',