{"version":3,"sources":["../../../../src/auth/strategies/local/resetLoginAttempts.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, TypeWithID } from '../../../collections/config/types.js'\nimport type { Payload } from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\n\ntype Args = {\n collection: SanitizedCollectionConfig\n doc: Record & TypeWithID\n payload: Payload\n req: PayloadRequest\n}\n\nexport const resetLoginAttempts = async ({\n collection,\n doc,\n payload,\n req,\n}: Args): Promise => {\n if (\n !('lockUntil' in doc && typeof doc.lockUntil === 'string') &&\n (!('loginAttempts' in doc) || doc.loginAttempts === 0)\n ) {\n return\n }\n await payload.db.updateOne({\n id: doc.id,\n collection: collection.slug,\n data: {\n lockUntil: null,\n loginAttempts: 0,\n },\n req,\n returning: false,\n })\n}\n"],"names":["resetLoginAttempts","collection","doc","payload","req","lockUntil","loginAttempts","db","updateOne","id","slug","data","returning"],"mappings":"AAWA,OAAO,MAAMA,qBAAqB,OAAO,EACvCC,UAAU,EACVC,GAAG,EACHC,OAAO,EACPC,GAAG,EACE;IACL,IACE,CAAE,CAAA,eAAeF,OAAO,OAAOA,IAAIG,SAAS,KAAK,QAAO,KACvD,CAAA,CAAE,CAAA,mBAAmBH,GAAE,KAAMA,IAAII,aAAa,KAAK,CAAA,GACpD;QACA;IACF;IACA,MAAMH,QAAQI,EAAE,CAACC,SAAS,CAAC;QACzBC,IAAIP,IAAIO,EAAE;QACVR,YAAYA,WAAWS,IAAI;QAC3BC,MAAM;YACJN,WAAW;YACXC,eAAe;QACjB;QACAF;QACAQ,WAAW;IACb;AACF,EAAC"}