Resetting users password

If you are the "administrator" or someone with a similar role and you want to reset your users password, here is what I do:

Create a custom Action accessible to administrators only

Create a business role with following code:

MembershipUser user = Membership.GetUser(username);
if (user != null)
{
string pw = "p@ssword123";
user.ChangePassword(user.ResetPassword(), pw);
Membership.UpdateUser(user);

Result.ExecuteOnClient("alert('Password for the user "+ username +" successfully reset')");
}
else
{
Result.ExecuteOnClient("alert('User does not exist for the employee "+ name +"')");
}

Hope this will help someone out there
2 people like
this idea
+1
Reply