What you're suggesting is for me to generate my own password, set the user's password then email it.
I was thinking about relying on the built-in password generation that comes with the membership module. I was only trying to get the new password so that I can email it to the user. Is there a way to do that? Better yet, is there a way to tell the membership
module to set the password and email it to user's email address?
I know I can use the ResetPassword() method to reset passwords but how do I get the newly created password so that I can email it?
You can't, but you can use the ResetPassword method to change the password in a password you want:
Private Sub ResetPassword(ByVal UserName As String, ByVal NewPassword As String)
Dim User As MembershipUser = Membership.GetUser(UserName)
User.ChangePassword(User.ResetPassword, NewPassword)
End Sub
SamU
Contributor
2895 Points
1625 Posts
Creating a reset password function for admins
Feb 21, 2012 08:15 PM|LINK
Hi,
I want to create a function that admins can use in my MVC 3 app to reset user passwords. I also want to email users their new password.
I know I can use the ResetPassword() method to reset passwords but how do I get the newly created password so that I can email it?
Sam
Muhammad Fak...
Contributor
2268 Points
511 Posts
Re: Creating a reset password function for admins
Feb 21, 2012 08:23 PM|LINK
This will help you alot, you can make it numbers, characters and even special characters and may be a combination of all that
http://www.obviex.com/Samples/Password.aspx
If you feel it helps, Mark as answered so that it can help others to find solution.
For Any further questions, please contact me.
SamU
Contributor
2895 Points
1625 Posts
Re: Creating a reset password function for admins
Feb 21, 2012 08:41 PM|LINK
What you're suggesting is for me to generate my own password, set the user's password then email it.
I was thinking about relying on the built-in password generation that comes with the membership module. I was only trying to get the new password so that I can email it to the user. Is there a way to do that? Better yet, is there a way to tell the membership module to set the password and email it to user's email address?
Sam
hans_v
All-Star
35986 Points
6550 Posts
Re: Creating a reset password function for admins
Feb 22, 2012 01:28 AM|LINK
You can't, but you can use the ResetPassword method to change the password in a password you want:
Private Sub ResetPassword(ByVal UserName As String, ByVal NewPassword As String) Dim User As MembershipUser = Membership.GetUser(UserName) User.ChangePassword(User.ResetPassword, NewPassword) End Sub