As the topic title says, I'm trying to create a member and then login programmatically.It would seem that when I call the ValidateUser function it can't login the newly created member and always returns false. The reason I'm trying to do this is because we currently authenticate via an external service - I then create a one time member login that get's deleted once the session ends.
Any help is greatly appreciated - code snippet below.
var memberService = Services.MemberService;
//create umbraco member and set the password as a random Guid
var member = CreateUmbracoMember();
if(memberService.Exists(member.Id))
{
if (Membership.ValidateUser(member.Username, member.RawPasswordValue))
{
//Always returns false
}
}
Create member then login programmatically
Hi all,
As the topic title says, I'm trying to create a member and then login programmatically.It would seem that when I call the ValidateUser function it can't login the newly created member and always returns false. The reason I'm trying to do this is because we currently authenticate via an external service - I then create a one time member login that get's deleted once the session ends.
Any help is greatly appreciated - code snippet below.
Hello,
You can login a member programmatically by doing the following:
Jeroen
That did the job, thanks!
Glad I could help. Can you please mark a post as the solution.
Jeroen
On a SurfaceController there is also the property
Members
which represents an instance ofUmbraco.Web.Security.MembershipHelper
this is for the password in clear mode. How solve for hashed password?
is working on a reply...