How to set expiration limit for forgotpassword token ?

default discord avatar
Veera26
9 months ago
6

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

  • default discord avatar
    thisisnotchris
    9 months ago

    @Veera26 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
    Veera26
    9 months ago

    OKay thanks



    I will look into it

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.