Bug reports Found a bug? Post it here please.
Version 7.x > Bug reports > User password defaulting to blank View modes: 
User avatar
Member
Member
mark-uniondigital.co - 10/10/2013 4:53:40 PM
   
User password defaulting to blank
the issue is that when you use
var user = UserInfoProvider.GetUserInfo(CMSContext.CurrentUser.UserID);
then the user's password defaults to blank (user["UserPassword]), so when you then update the user (either user.Update(); or UserInfoProvider.SetUserInfo(user);) then that sets the password to blank.
Interestingly if you then set the password in the back end then user["UserPassword"] will actually display the correct value.

So solution is to use
var user = UserInfoProvider.GetUserInfoByGUID(CMSContext.CurrentUser.UserGUID);
as this (for whatever reason) actually loads in the correct password for the user.

Bit fucked up really... causing many hours of pain, and as they say, time is money.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 10/11/2013 2:53:19 AM
   
RE:User password defaulting to blank
Hi,

Thank you for your message.

I tried following code:


CMS.SiteProvider.UserInfo myUser = CMS.SiteProvider.UserInfoProvider.GetUserInfo(67);
myUser.UserName = "LukeH2";
myUser.Update()


And the password remained untouched. I believe that this is because you are using "var" which is not a UserObject. What you need to use is UserInfo object. Can you try this?

Kind regards,
Richard Sustek