I've come across a problem, it could be due to my limited knowledge of umbraco (fairly new to it). However, what I'm trying to achieve is using the functionality of the umbraco password hash encryption.
The reason behind this is so I can create a custom Login/register form, but for me to match/insert the correct values in the umbraco tables I need to hash/encrypt the password the same way it has been done already.
Now I've managed to achieve adding the user in find. But it's for the password hash/encryption alone I need to use. For example:
Also currently importing the following in this custom login/register class:
[code]
using umbraco.cms.businesslogic.member; using umbraco.cms.businesslogic.propertytype;
[/code]
[code]
// umbraco way of doing things =] public bool AddUmbracoMember(string pEmail, string pName, string pPassword, string[] pData) { bool addedUser = true;
if (Member.GetMemberFromEmail(pEmail) == null) { MemberType memberType = new MemberType(1032);
Member newUser = Member.MakeNew(pName, memberType, new umbraco.BusinessLogic.User(0)); newUser.Email = pEmail; newUser.Password = pPassword; newUser.LoginName = pName; newUser.Save();
If you need to encrypt passwords, you should take a look at how it's done in umbraco (as you'd like to add members in the umbraco member table, so encryption should be identical).
Password encryption is used in the umbraco membership provider implementation, so there's where you should take a peek.
On a sidenote, I don't really understand why you're doing your own AddUmbracoMember() function? If you need to create your own login/registration process, you should roll your own membership provider implementation and replace the default umbraco one.
I might not have completely understood the question though.
How to encrypt passwords with umbraco
Hello,
I've come across a problem, it could be due to my limited knowledge of umbraco (fairly new to it). However, what I'm trying to achieve is using the functionality of the umbraco password hash encryption.
The reason behind this is so I can create a custom Login/register form, but for me to match/insert the correct values in the umbraco tables I need to hash/encrypt the password the same way it has been done already.
Now I've managed to achieve adding the user in find. But it's for the password hash/encryption alone I need to use. For example:
Also currently importing the following in this custom login/register class:
[code]
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.propertytype;
[/code]
[code]
// umbraco way of doing things =]
public bool AddUmbracoMember(string pEmail, string pName, string pPassword, string[] pData)
{
bool addedUser = true;
if (Member.GetMemberFromEmail(pEmail) == null)
{
MemberType memberType = new MemberType(1032);
Member newUser = Member.MakeNew(pName, memberType, new umbraco.BusinessLogic.User(0));
newUser.Email = pEmail;
newUser.Password = pPassword;
newUser.LoginName = pName;
newUser.Save();
AddNewUserData(pEmail, pData);
}
else
{
addedUser = false;
}
return addedUser;
}
[/code]
But of course using the
[code]
newUser.Password = pPassword;
[/code]
on its own doesn't work as it's only accepting values and not returning. Let me know if you've got any solutions for this problem of mine.
Thanks,
Shaun
Hi,
If you need to encrypt passwords, you should take a look at how it's done in umbraco (as you'd like to add members in the umbraco member table, so encryption should be identical).
Password encryption is used in the umbraco membership provider implementation, so there's where you should take a peek.
On a sidenote, I don't really understand why you're doing your own AddUmbracoMember() function? If you need to create your own login/registration process, you should roll your own membership provider implementation and replace the default umbraco one.
I might not have completely understood the question though.
Cheers,
/Dirk
Use the umbraco.providers.UsersMembershipProvider.EncodePassword() funtion.
Thomas
is working on a reply...