Skip rate limiting on admin users

This commit is contained in:
DrMint 2024-05-12 12:44:41 +02:00
parent 03baffdc3c
commit f796de1438
2 changed files with 11 additions and 1 deletions

View File

@ -65,7 +65,11 @@ export const Recorders = buildCollectionConfig({
],
},
},
auth: { tokenExpiration: 24 * 60 * 60 },
auth: {
tokenExpiration: 24 * 60 * 60, // 1 day
maxLoginAttempts: 5,
lockTime: 900_000, // 15 minutes
},
access: {
unlock: mustBeAdminForCollections,
update: mustBeAdminOrSelf,

View File

@ -4,6 +4,7 @@ import { cloudStorage } from "@payloadcms/plugin-cloud-storage";
import path from "path";
import { buildConfig } from "payload/config";
import { sftpAdapter } from "payloadcms-sftp-storage";
import { mustBeAdmin } from "./accesses/collections/mustBeAdmin";
import { Audios } from "./collections/Audios/Audios";
import { ChronologyEvents } from "./collections/ChronologyEvents/ChronologyEvents";
import { Collectibles } from "./collections/Collectibles/Collectibles";
@ -87,6 +88,11 @@ export default buildConfig({
graphQL: {
disable: true,
},
rateLimit: {
window: 900_000, // 15 minutes
max: 500,
skip: (req) => !!mustBeAdmin({ req }),
},
plugins: [
cloudStorage({
collections: {