W
W
Wasya UK2018-08-11 22:49:26
Node.js
Wasya UK, 2018-08-11 22:49:26

How to do verification via email?

I do registration, everything works, but the user can enter any mail and give a ride, I would like there to be some kind of verification. I decided to send a check to the specified mail for confirmation, but I don’t really understand how this is done. Here I take the nodemailer module, and then how do I follow the link, that is, I don’t really understand how to form links and make them confirming. There are several ideas, but I would like to hear the correct option, and not invent a bicycle without wheels.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2018-08-11
@dmc1989

In the database, store a user with an id not int, but guid. Also add the status field, in which 0 - not activated, 1 - activated.
In the confirmation letter, make the link yoursite.com/confirm/3ad5ccdb-f605-40db-9146-2c6bf...
When you go to the confirm route, look for the user in the database by guid and set his status to 1.
When authorizing users with status 0, do not let them in, offer resend the activation email.

A
Abcdefgk, 2018-08-12
@Abcdefgk

Yes, it's still pointless, there are a lot of disposable mailboxes. ->

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question