Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I don't understand how email activation works

I want to verify that the user email is valid and turn this email into his id in my system. Yet I don't know how to make a link in the mail, that activates the account like(facebook and others ) and I don't really understand what happens when the link is selected.

I thought of generating a key like "sdklbsdgk4493" to enter once- so that guessing is hard, yet for many people copy and paste is not trivial and I may annoy them with this solution.

Any thoughts or ideas?

p.s: I'm working in c# so if it can be done with c#... it will be great :)

Thanks Asaf

like image 671
Asaf Avatar asked Dec 02 '22 04:12

Asaf


2 Answers

When you insert a new user in the Database, their status should be "Deactivated" and you insert a "GUID" you generate alongside. You send them a link to your activation Page which would contain this GUID in the Query String. It will look like this:

www.YourSite.com/Activation.aspx?GUID=jdfhg43h98234

In the Activation.aspx page, you take this GUID from the Query String and compare it to the one you have in the Database. You then activate the Account having that GUID.

like image 178
Arrabi Avatar answered Dec 03 '22 18:12

Arrabi


  1. Create the user

  2. Generate a unique string for the user

  3. Have a Table that stores the unique string, the user Id ,a boolean that holds whether it got activated or not, the generation date, the expiration date and if you have different uses for these activation strings, the type(link to another table)

  4. Now within the email you should get the string and write it within the email along with a link to the page you're going to use for validation such as whatever.com/verify.aspx?activationString=hd3fd33fen342n43

  5. Within this page you do a query search within the table that holds the keys and if its not already validated

like image 41
Andrew Camilleri 'Kukks' Avatar answered Dec 03 '22 17:12

Andrew Camilleri 'Kukks'