Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

How to set expiration limit for forgotpassword token ?

default discord avatar
veera262 years ago
2

How to change expiration limit for forgot password token from 1 hour ?

  • default discord avatar
    notchr2 years ago
    @943144613689065502

    According to the source, the options for forgotPassword are as follows:


    export type Arguments = {
      collection: Collection
      data: {
        email: string
        [key: string]: unknown
      }
      disableEmail?: boolean
      expiration?: number
      req: PayloadRequest
    }


    reference:

    https://github.com/payloadcms/payload/blob/master/src/auth/operations/forgotPassword.ts

    Lucky for you, the default is one hour



      user.resetPasswordExpiration = expiration || Date.now() + 3600000; // 1 hour
  • default discord avatar
    veera262 years ago

    OKay thanks



    I will look into it

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.