views:

593

answers:

6

Hi every one!

I am developing an app which I should design a page for users who forget passwords and send email to them the new passwords. I am using ASP.NET Membership and password format should be hashed.

My problem is when sending mail has been failed, password has been changed and wow! no work can be done.

what is your solution?

A: 

The user should change their password again, and hopefully the email will succeed.

If they entered an incorrect address, they should contact an administrator who can correct their email address.

JoshJordan
A: 

If it is possible to tell if an e-mail is successfully sent before you actually commit the change to the database this would be a good option. This isn't always the case, but maybe it could work for your application.

Usually with my experience ASP will thrown an exception if the e-mail fails. If this happens don't do anything in the DB, if the mail goes through then change the password. That doesn't mean they will get the e-mail but you can't account for problems during travel of the e-mail anyway. The option above would apply after this fails. ;)

Wade
Missed by a few seconds ;)
shahkalpesh
it's a good solution but the User sees two email one for test and one for he passord, and this is not good.
A: 

I don't know the support for such a feature in asp.net.

But, some website send you an email with a link to click (that expires in some days). Clicking which, will make sure you are committing to that action (i.e. password is changed only after they receive email & click the link they received).

shahkalpesh
you mean I should have a table to store a random value for the user to check that the user was that user that i sent that email?
A: 

ASP.NET also supports the question and secret answer approach to password recovery if email doesnt work.

Keith
+1  A: 

You should send users an email with a link, where they can confirm password reset (otherwise you could reset passwords to other users by guessing their emails). On the linked page users would then confirm password reset (or even change it themselves).

But it's a better practice not to send passwords in any way shape or form. It's the most secure.

The process

  1. Users request password reset by their email.
  2. They receive an email with a link
  3. Theyclick the link and provide a new password that gets hashed right away and stored in the system.
Robert Koritnik
great! but can I hashed the password the way ASP.NET does, I mean can I store it directly to the Users table.
You could call Membership.UpdateUser and set new password.
Robert Koritnik
+1  A: 
Jon Galloway
this is a good solution, but I am not sure it works or not? Are you sure?