I came across a few posts were people sugest to use MemberShipHelper to encode a password before save it. I started building a test project with 4.1RC and it was there, now that I'm upgrading the test to 4.5, it can't find the MemberShipHelper anymore, looks like it not implemented.
I'd like to change a user password using the API. The thing is the User.Password method will save the password as it is on the database, however, looks like umbraco is expecting a encrypted password (at least it's encrypting the passwords created through the backend.
I'm looking at the sources right now but i can't find where it encode the password.
I had tried that already but didn't work as well. It won't change the UserPassword field on the umbracoUser table. Looks like to change that i have to set the user.Password property of a User object, however, i need to pass a encoded password to this property (i'm kind of confused here.
Here is my code:
Dim uname As String = "myName" Dim upass As String = "MyPass"
Dim umuser As MembershipUser = Membership.Providers(UmbracoSettings.DefaultBackofficeProvider).GetUser(uname, True) Dim oldPass As String = umuser.ResetPassword umuser.ChangePassword(oldPass, upass) Membership.Providers(UmbracoSettings.DefaultBackofficeProvider).UpdateUser(umuser)
Is MemberShipHelper out of 4.5?
I came across a few posts were people sugest to use MemberShipHelper to encode a password before save it.
I started building a test project with 4.1RC and it was there, now that I'm upgrading the test to 4.5, it can't find the MemberShipHelper anymore, looks like it not implemented.
Considering it's missing, how can i encode and save an user password?
umbraco.cms.businesslogic.member.Member.MemberShipHelper was a horrible hack that was never meant to be exposed to anyone.
If you are working with members you should be going through the MembershipProvider API. See the wiki as to how to do it: http://our.umbraco.org/wiki/how-tos/membership-providers
Thanks Slace;
I'm actually working with users (administrators).
I'd like to change a user password using the API. The thing is the User.Password method will save the password as it is on the database, however, looks like umbraco is expecting a encrypted password (at least it's encrypting the passwords created through the backend.
I'm looking at the sources right now but i can't find where it encode the password.
Then you should explicitly get the UserMembershipProvider out of the membership provider collection. This is what Umbraco does:
I had tried that already but didn't work as well.
It won't change the UserPassword field on the umbracoUser table. Looks like to change that i have to set the user.Password property of a User object, however, i need to pass a encoded password to this property (i'm kind of confused here.
Here is my code:
You don't need to call UpdateUser, otherwise that's pretty much what is done by the back office ASPX page: http://umbraco.codeplex.com/SourceControl/changeset/view/71737#906806
Exactly. I don't understand why it doesn't work. I'm sure I'm still missing something.
is working on a reply...