Search code examples
asp.net-mvcpasswordssimplemembership

How to set default Password in MVC simple membership?


I am working on a project where my user will be pre-loaded in the database. All user will be forced to change the default password at first login.

I would like to know a way to set users password to a default password? How can I reset it back to default case a user forgets it?

I made some research and I am now learning about the websecurity table, but I am not very clear about all its mechanisms.


Solution

  • Assuming that you have a method for notifying users, such as email, you could use the password reset mechanism in SimpleMembership to have users login for the first time. Take a look at this article on implementing password reset in SimpleMembership. You could develop the import process to create the new users and assign a random password which will never be used and then issue a reset password token that is automatically emailed to each user, as described in the article. The user would select a link in the email to login for the first time and reset their password to something that they will remember. If they forget their password you do not need to reset it back to a default; just have them do the password reset process as described in the article. I think this is more secure than emailing and managing default passwords.