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.

Allow login before email verification

default discord avatar
scidroid3 years ago
6

I want users to login in my application before they verify their email, maybe only allow them to do certain actions before they verify it.



Also how can I know a user is not verified so i can send another verification email.



It's any way in payload to do this?

  • discord user avatar
    jacobsfletch
    3 years ago
    @710199181305839707

    email verification is optional if you did not set

    verify: true

    on your user collection config. When enabled, though, it adds a

    _verified

    field to your user that you can use for any purpose.

  • default discord avatar
    omri04782 years ago

    Hey

    @710199181305839707

    did you find a solution to allowing users to login before they verify their email? I'm trying to achieve the same outcome but can't find a solution.



    tnx!



    @808734492645785600

    How can we set up Payload's email verification so it's not required to sign in, but needed for later actions? For example, a user signs up, gets a verification email, is logged in automatically, but must verify their email to do certain things later. How do we do this?



    tnx

  • default discord avatar
    scidroid2 years ago
    @795583828281393192

    i added a custom token for email authentication, a custom verified property and a hook for every request



    basically when you create a new user, you create an uuid or something like that



    then you send the email and create an endpoint that find the user with that uuid and add a "verified" property to the document

  • default discord avatar
    notchr2 years ago

    It's good practice to have users verify their emails, but of coursethere are varying situations



    But from a security point of view, it's a better path

  • default discord avatar
    scidroid2 years ago

    and then in a prehook (i dont remenber the name in payload) you block the request if the resource enforces email verification or if the time window is short, like the first hour of an registered user



    yeah definitely, but sometimes you want to allow users to have some interactivity at the time when the account is created



    like you have some time to verify your email meanwhile you can access some content



    is a ux practice that is valid for some services

  • default discord avatar
    omri04782 years ago

    Exactly, thank you

    @710199181305839707
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.