fix: allow custom password field when using disableLocalStrategy: true (#11893)
Fixes https://github.com/payloadcms/payload/issues/11888 Previously, if you had `disableLocalStategy: true` and a custom `password` field, Payload would still control it in `update.ts` by deleting. Now, we don't do that in this case, unless we have `disableLocalStetegy.enableFields: true`.
This commit is contained in:
@@ -99,7 +99,14 @@ export const updateDocument = async <
|
||||
const password = data?.password
|
||||
const shouldSaveDraft =
|
||||
Boolean(draftArg && collectionConfig.versions.drafts) && data._status !== 'published'
|
||||
const shouldSavePassword = Boolean(password && collectionConfig.auth && !shouldSaveDraft)
|
||||
const shouldSavePassword = Boolean(
|
||||
password &&
|
||||
collectionConfig.auth &&
|
||||
(!collectionConfig.auth.disableLocalStrategy ||
|
||||
(typeof collectionConfig.auth.disableLocalStrategy === 'object' &&
|
||||
collectionConfig.auth.disableLocalStrategy.enableFields)) &&
|
||||
!shouldSaveDraft,
|
||||
)
|
||||
|
||||
// /////////////////////////////////////
|
||||
// Handle potentially locked documents
|
||||
|
||||
Reference in New Issue
Block a user