Create member with MemberService.CreateWithIdentity
I take it this new membership service doesnt automatically hash the given password or am i using this wrong. I have noticed the member password is saved in plain text when i create a new member but the log process i.e. either Membership.ValidateUser() or memberShipHelper.Login() tries to log in the user with the given password as hashed.
So with both in place my newly created members couldnt log in regardless of the web config membership providers are set to use the password formatt as hashed. So my work around at the moment is to either hash the password myself with my own class or create the member first with MemberService.CreateMember() then call MemberService.SavePassword() immediately after creating the member (which i belive this call is mainly to update the password when changed or updated).
Dont know if its me here but should this hash the password by default since every other call does use a hashed password, so unless if you set it otherwise this should be the default method, probably there is a reason hwy just cant see it at the moment, not to memntion the documentation doesnt mention anything about it.
Quite annoying isnt it lol, well MemberService.SavePassword() seems to be the way i gues,no officical word from the Umbraco gurus though about how exactly this should work.
I reverted back to the standard .net method which works fine and created the object so I could easily pass in property data to the member. The member profile stuff is a faff!.
Apparently you are supposed to use the MemberShipHelper class for creating members, rather than directly via the Member Service. I only discovered this by accident by talking to a core developer, as it wasn't well documented. For instance, creating members via the Membership Service doesn't do any real checks - so you can actually create two members with the exact same username.
However, I'm pretty sure you can create a hashed password using the Member Service - I'm sure I've done something like this before:
var memberService = this.UmbracoContext.Application.Services.MemberService;
var memberGroupService = this.UmbracoContext.Application.Services.MemberGroupService;
var newMember = memberService.CreateMemberWithIdentity(this.Model.Username, this.Model.Email, this.Model.Name, this.Model.MembershipTypeAlias);
newMember.IsApproved = false;
memberService.SavePassword(newMember, this.Model.Password);
memberService.Save(newMember);
@danDiplo yes that how i ended up doing it i actually have a hybrid of the two use the membership helper to check if there is already a member logged in and if the email being registered is already used. Then call on the member service to actually create the member, add custom properites save that member first then add the password after. NB save the member first then assign the password after as it will not have a db member yet to put the password onto, caught me out that.
Create member with MemberService.CreateWithIdentity
I take it this new membership service doesnt automatically hash the given password or am i using this wrong. I have noticed the member password is saved in plain text when i create a new member but the log process i.e. either Membership.ValidateUser() or memberShipHelper.Login() tries to log in the user with the given password as hashed.
So with both in place my newly created members couldnt log in regardless of the web config membership providers are set to use the password formatt as hashed. So my work around at the moment is to either hash the password myself with my own class or create the member first with MemberService.CreateMember() then call MemberService.SavePassword() immediately after creating the member (which i belive this call is mainly to update the password when changed or updated).
Dont know if its me here but should this hash the password by default since every other call does use a hashed password, so unless if you set it otherwise this should be the default method, probably there is a reason hwy just cant see it at the moment, not to memntion the documentation doesnt mention anything about it.
http://our.umbraco.org/Documentation/Reference/Management-v6/Services/MemberService
Bump! Same for me!
Quite annoying isnt it lol, well MemberService.SavePassword() seems to be the way i gues,no officical word from the Umbraco gurus though about how exactly this should work.
I reverted back to the standard .net method which works fine and created the object so I could easily pass in property data to the member. The member profile stuff is a faff!.
Apparently you are supposed to use the MemberShipHelper class for creating members, rather than directly via the Member Service. I only discovered this by accident by talking to a core developer, as it wasn't well documented. For instance, creating members via the Membership Service doesn't do any real checks - so you can actually create two members with the exact same username.
However, I'm pretty sure you can create a hashed password using the Member Service - I'm sure I've done something like this before:
@danDiplo yes that how i ended up doing it i actually have a hybrid of the two use the membership helper to check if there is already a member logged in and if the email being registered is already used. Then call on the member service to actually create the member, add custom properites save that member first then add the password after. NB save the member first then assign the password after as it will not have a db member yet to put the password onto, caught me out that.
is working on a reply...