ma ouml

ma ouml

  • NA
  • 436
  • 89.3k

How to add options to send a verification code

Aug 11 2017 5:31 AM
Hi friends
I create a website and I want to add this options that allows
That when the user forgets his password one will ask him to enter his email after he is told that he enters a verification code in the email
How to do this please and thanks in advance friends

Answers (3)

1
Nilesh Shah

Nilesh Shah

  • 13
  • 54.3k
  • 1.3m
Aug 22 2017 9:13 AM
Hi ma ouml
 
What happened?
 
Did you find any solution? If my answer worked for you, please mark it as "Accepted" and close this question.
1
Nilesh Shah

Nilesh Shah

  • 13
  • 54.3k
  • 1.3m
Aug 11 2017 9:10 AM

you need to maintain a table like below, the name of table can be "ForgotPasswordRequests":

ForgotPasswordRequestID - Guid

UserID - id of user who needs to reset password
 
IsActive - boolean - set it to 1 when entering new request, set it to 0 when this record is used to reset password, check while reset request comes, if 0 then link was already used
 
when user wants to reset password, generate a guid and enter a record in above table, send email with link like http://yourwebsite.com/forgotpassword?requestid=3c158bcf-91cf-4a56-9b6d-488d123e4581
 
for asp.net this link can be a asmx handler, for mvc it can be a controller
 
then in that handler code write logic to fetch userid based on guid from query string, present user with web ui to reset password, change password in db, set this record's isactive to 0, you are done!
0
ma ouml

ma ouml

  • 0
  • 436
  • 89.3k
Aug 22 2017 12:07 PM
Nilesh Shah
it doesn't work