private void PopulateControls() { if (!siteSettings.RequiresQuestionAndAnswer) { divSecurityQuestion.Visible = false; divSecurityAnswer.Visible = false; } if ((siteUser != null) && (siteUser.UserId > -1)) { spnTitle.InnerText = Resource.ManageUsersTitleLabel + " " + siteUser.Name; txtName.Text = siteUser.Name; this.txtLoginName.Text = siteUser.LoginName; lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(string.Format(CultureInfo.InvariantCulture, Resource.UploadAvatarForUserFormat, siteUser.Name)) + "', this.href, GBCallback)"; txtEmail.Text = siteUser.Email; txtOpenIDURI.Text = siteUser.OpenIdUri; txtWindowsLiveID.Text = siteUser.WindowsLiveId; txtLiveMessengerCID.Text = siteUser.LiveMessengerId; chkEnableLiveMessengerOnProfile.Checked = siteUser.EnableLiveMessengerOnProfile; gravatar1.Email = siteUser.Email; gravatar1.MaxAllowedRating = MaxAllowedGravatarRating; if (siteUser.LastActivityDate > DateTime.MinValue) { this.lblLastActivityDate.Text = siteUser.LastActivityDate.AddHours(TimeOffset).ToString(); } if (siteUser.LastLoginDate > DateTime.MinValue) { this.lblLastLoginDate.Text = siteUser.LastLoginDate.AddHours(TimeOffset).ToString(); } if (siteUser.LastPasswordChangedDate > DateTime.MinValue) { this.lblLastPasswordChangeDate.Text = siteUser.LastPasswordChangedDate.AddHours(TimeOffset).ToString(); } if (siteUser.LastLockoutDate > DateTime.MinValue) { this.lblLastLockoutDate.Text = siteUser.LastLockoutDate.AddHours(TimeOffset).ToString(); } this.lblFailedPasswordAttemptCount.Text = siteUser.FailedPasswordAttemptCount.ToString(); this.lblFailedPasswordAnswerAttemptCount.Text = siteUser.FailedPasswordAnswerAttemptCount.ToString(); this.chkIsLockedOut.Checked = siteUser.IsLockedOut; btnLockUser.Visible = !siteUser.IsLockedOut; btnUnlockUser.Visible = siteUser.IsLockedOut; if (siteSettings.UseSecureRegistration) { if (siteUser.RegisterConfirmGuid == Guid.Empty) { chkEmailIsConfirmed.Checked = true; btnConfirmEmail.Enabled = false; } } else { divEmailConfirm.Visible = false; } this.txtComment.Text = siteUser.Comment; this.txtPasswordQuestion.Text = siteUser.PasswordQuestion; this.txtPasswordAnswer.Text = siteUser.PasswordAnswer; if (!siteSettings.UseLdapAuth) { if (siteSettings.PasswordFormat == 0) { //Clear this.txtPassword.Text = siteUser.Password; } else if (siteSettings.PasswordFormat == 2) { try { CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider; this.txtPassword.Text = CMembership.UnencodePassword(siteUser.Password, MembershipPasswordFormat.Encrypted); } catch (FormatException ex) { log.Error("Error decoding password for user " + siteUser.Email + " on manage users page.", ex); // TODO: should we generate a random password and fix it here? } } } lblCreatedDate.Text = siteUser.DateCreated.AddHours(TimeOffset).ToString(); lblUserGuid.Text = siteUser.UserGuid.ToString(); lblTotalPosts.Text = siteUser.TotalPosts.ToString(); lnkUserPosts.UserId = siteUser.UserId; lnkUserPosts.TotalPosts = siteUser.TotalPosts; lnkUnsubscribeFromGroups.NavigateUrl = SiteRoot + "/Groups/UnsubscribeGroup.aspx?ue=" + Page.Server.UrlEncode(siteUser.Email); chkProfileApproved.Checked = siteUser.ProfileApproved; chkApprovedForGroups.Checked = siteUser.ApprovedForGroups; chkTrusted.Checked = siteUser.Trusted; chkDisplayInMemberList.Checked = siteUser.DisplayInMemberList; //ListItem listItem; if ((!allowGravatars) && (!disableAvatars)) { if (siteUser.AvatarUrl.Length > 0) { //listItem = ddAvatars.Items.FindByValue(siteUser.AvatarUrl); //if (listItem != null) //{ // ddAvatars.ClearSelection(); // listItem.Selected = true; //} imgAvatar.Src = ImageSiteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/" + siteUser.AvatarUrl; } else { imgAvatar.Src = ImageSiteRoot + "/Data/SiteImages/1x1.gif"; } } using (IDataReader reader = SiteUser.GetRolesByUser(siteSettings.SiteId, siteUser.UserId)) { userRoles.DataSource = reader; userRoles.DataBind(); } using (IDataReader reader = Role.GetRolesUserIsNotIn(siteSettings.SiteId, siteUser.UserId)) { allRoles.DataSource = reader; allRoles.DataBind(); } if (allRoles.Items.Count == 0) { allRoles.Enabled = false; addExisting.Enabled = false; addExisting.Text = Resource.ManageUsersUserIsInAllRolesMessage; } List <UserLocation> userLocations = UserLocation.GetByUser(siteUser.UserGuid); grdUserLocation.DataSource = userLocations; grdUserLocation.DataBind(); } else { spnTitle.InnerText = Resource.ManageUsersAddUserLabel; HideExtendedProfileControls(); } }