brianRingler / time-distance-tracker

https://time-distance-tracker.vercel.app
0 stars 1 forks source link

Validate Email - React-Hook-Form #15

Open brianRingler opened 10 months ago

brianRingler commented 10 months ago

When a user is registering an account how do we want to validate that they are human so out application is not spammed? We will probably have billions of users and inevitably someone will try and crash our database.

The other question is how we validate that the email is there's before adding them to the database?

1) Check if user is Human when registering an account?

2) How to validate that the email they used is there's before adding them to the database?

imaricodes commented 10 months ago

Good questions.

  1. There is a library for google captcha. Here's an example of how to use with react-hook-form: https://www.phind.com/agent?cache=clner314n003hlc08bxis5m23 . Check out the recapcha branch...

  2. I think after verifying humanity, we add user to db, but also have a email_verified field. That would remain false until the user verifies the email. My guess is there is some package to verify email addresses (by sending a verification link). The user may have different authorization depending on whether their email is verified. This info would be in the user profile while a session is in progress.

imaricodes commented 10 months ago

Re: #2...

Next-Auth has an email provider that will send either a magic link to log in if the user already exists, or a verification email. At first glance, seems like the solution. Still reading about it.