0

I'm working on a nodejs project, I used passportjs in nodejs to create a login system. Everything seems ok, but I do not know how I can go about password recovery so that in the case of a lost or forgotten password, you have the option to receive a text message (SMS) or voice call to recover your account.

I want trying How To Implement Password Reset In Node.js, but the example there show password recovery via email.

I have checked this Stackoverflow questions already, but none of them helps in what I plan to archive:

I will greatly appreciate any help.

Thank a million in advance.

antzshrek
  • 9,276
  • 5
  • 26
  • 43
  • What you do is match the phone number on that you have stored to the one that user sends you when he tries to recover his or her password. If it is valid, ask the user to set a new password. Once he sends that in, store it and allow the user to login. – Jesse Schokker Nov 09 '17 at 17:11
  • @JesseSchokker — That would just be using the telephone number as a password. Anybody could have their account broken into by anyone who knows their phone number … which isn't secret information! – Quentin Nov 09 '17 at 17:12
  • Your question isn't clear. Are you asking how to send an SMS? (You've linked to a question that explains how.) Are you asking how to expire a token if it isn't used in a certain about of time? Are you asking how to sign up for Twilio or Nexo mo? (Your problems there seem like they would be much better address to their customer service department). – Quentin Nov 09 '17 at 17:14
  • @Quentin I have edited the question, I don't know if it is now clear enough and can be re-opened? – antzshrek Nov 09 '17 at 18:17

1 Answers1

1

Disclaimer, I do not have experience in Nodejs and this is a rough example.

Find a service that can send texts to users such as twilio. Generate an authentication code using a random generator when user presses button. Use that authentication code as a key to a map where the value is the user.

Then when the user inputs the code you can lookup the User to reset using the map created before.

The map you would want to store in your database.

spitfire21
  • 103
  • 4