Merge pull request #5293 from payloadcms/fix/auth-schema-and-client-side
fix (alpha): `auth.strategies` schema and removal of auth functions from client config
This commit is contained in:
@@ -94,16 +94,10 @@ const collectionSchema = joi.object().keys({
|
||||
maxLoginAttempts: joi.number(),
|
||||
removeTokenFromResponses: joi.boolean().valid(true),
|
||||
strategies: joi.array().items(
|
||||
joi.alternatives().try(
|
||||
strategyBaseSchema.keys({
|
||||
name: joi.string().required(),
|
||||
strategy: joi.func().maxArity(1).required(),
|
||||
}),
|
||||
strategyBaseSchema.keys({
|
||||
name: joi.string(),
|
||||
strategy: joi.object().required(),
|
||||
}),
|
||||
),
|
||||
joi.object().keys({
|
||||
name: joi.string().required(),
|
||||
authenticate: joi.func().required(),
|
||||
}),
|
||||
),
|
||||
tokenExpiration: joi.number(),
|
||||
useAPIKey: joi.boolean(),
|
||||
|
||||
@@ -85,6 +85,13 @@ const sanitizeCollections = (
|
||||
delete sanitized.upload.handlers
|
||||
}
|
||||
|
||||
if ('auth' in sanitized && typeof sanitized.auth === 'object') {
|
||||
sanitized.auth = { ...sanitized.auth }
|
||||
delete sanitized.auth.strategies
|
||||
delete sanitized.auth.forgotPassword
|
||||
delete sanitized.auth.verify
|
||||
}
|
||||
|
||||
if ('admin' in sanitized) {
|
||||
sanitized.admin = { ...sanitized.admin }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user