Password recovery

With a web App, What can i do to get the app send password back to the mail address of the end user in case of forgot password. More also,like what we see in gmail,to get the app send some specific numbers to the user phone and get your mail open. What can i do to get the App do such functions? My attempt has not giving me the right result. Help

I would not recommend to send the password via Email. Better generate a new Password each time the user forgot the password.
If you can send the forgotten password via Mail then the user has to assume that you can read the password AND it’s not safe to send passwords via Email anyway. :wink:

You would have to write methods for creating, storing (for a limited time), erasing and verifying such numbers by yourself.
You App could generate a number and store it. The generated code should have additional informations in the database, like for which account it was generated and when it will become invalid and so on.
Then when the user opens your WebApp using an extended URL which includes the code, you WebApp could present the Mail f.e.

@Sascha S, Thanks so much,I must say,you open my eye to another way of thinking perfect. Great one.

Passwords should never be stored in such way they can be retrieved and sent to the user like Sascha said. Big no, no :slight_smile:

A bit OT, but very relevant.
While we’re at the password subject, here’s a great read on how to store passwords securely by @Thom McGrath
http://thezaz.com/blog/2013/12/storing_passwords_securely_wit.html

Thanks to Albin Kiland