Portal Engine
Version 3.x > Portal Engine > How to set password programmatically? View modes: 
User avatar
Member
Member
Dissenter - 6/22/2009 6:10:55 PM
   
How to set password programmatically?
Hello all.

In some Kentico customizations I've done, I have a form that takes some input and creates a user account. I'm using this code to twrite to the CMS_User table:

// Set some properties
user.UserName = ltEMail.Text;
user.FirstName = lt_first_name.Text;
user.LastName = lt_last_name.Text;
user.FullName = lt_first_name.Text + " " + lt_last_name.Text;
user.Email = ltEMail.Text;
user.IsEditor = false;
user.PreferredCultureCode = "en-us";
// Create new user
CMS.SiteProvider.UserInfoProvider.SetUserInfo(user);

What I need to know is, how can I set a password for this new user programmatically? We're using hashed passwords in our site.