Reputation: 1442
I'm very new to DotNetNuke but I'm creating a custom module where a user can update their details which will then be saved. One of these things is the password. I dont know the best way to insert something into the DotNetNuke database or which table the password is stored in. Can anyone help me with this?
Thanks
EDIT: I've noticed a "ChangePassword" function under the UserController class which would sound like it would do the trick, however its asking for the old password of the user which I don't know how to get
Upvotes: 2
Views: 4291
Reputation: 249
You don't need to know the old password, use
MembershipProvider.Instance().ResetAndChangePassword(user, "password");
where user is UserInfo type object of your user, "password" is the string with new password. It works in dnn 7.
Upvotes: 3
Reputation: 3330
I have had success getting and updating a user's password using the following code.
strUsername = Entities.Users.UserController.GetCurrentUserInfo.Username
strPassword = Membership.Provider.GetPassword(strUsername, String.Empty)
Membership.Provider.ChangePassword(strUsername, strPassword, txtPassword.Text)
Upvotes: 2