chingu-voyages / v42-bears-team-34

Add-project-description-here | Voyage-42 | https://chingu.io/ | Twitter: https://twitter.com/ChinguCollabs
1 stars 0 forks source link

E-mail integration #32

Closed davideastmond closed 1 year ago

davideastmond commented 1 year ago

Feature Description Stretch goal

Major User Stories/tasks

Additional Considerations Include anything else that may be helpful. For example, links to external resources.

Alfrederson commented 1 year ago

E-mail verification goes like this:

When a get request is made to /verfy/:verificationstring , then the backend will search for that verificationstring parameter and change a "activated" field within the user record to true.

The user needs to have an option to resend a verification link, which does all those 3 steps again unless the user is already activated.

In PostgreSQL it's ideal to create an index for the "Users" table based on the verification string, which makes identifying the user really fast.

Since all of this involves database operations ($$), it's ideal to use some type of rate limitting on the backend. I don't know if the ideal is to use some library like express-rate-limit or if this would be a service provided by Cloudflare or whichever load balancer would be in place.

So, question is:

How does one create indices for fields in MongoDB?