private bool IsValidForUserCreation(OpenIdRpxAuthInfo authInfo)
        {
            bool result = true;

            if (authInfo == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(authInfo.Email))
            {
                return(false);
            }


            if (!Email.IsValidEmailAddressSyntax(authInfo.Email))
            {
                return(false);
            }

            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig.HasRequiredCustomProperties())
            {
                result = false;
            }

            return(result);
        }
        private bool IsValidForUserCreation(OpenIdEventArgs e, ClaimsResponse claim)
        {
            bool result = true;

            if (claim == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(claim.Email))
            {
                return(false);
            }
            if (String.IsNullOrEmpty(claim.FullName))
            {
                return(false);
            }

            if (!Email.IsValidEmailAddressSyntax(claim.Email))
            {
                return(false);
            }

            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig.HasRequiredCustomProperties())
            {
                result = false;
            }

            return(result);
        }
        private void ShowAnonymousProperties(SiteUser siteUser)
        {
            bool wouldSeeMoreIfAuthenticated = false;

            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig != null)
            {
                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (
                        (propertyDefinition.VisibleToAnonymous) &&
                        (propertyDefinition.OnlyVisibleForRoles.Length == 0) &&
                        (
                            (propertyDefinition.OnlyAvailableForRoles.Length == 0) ||
                            (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                        )
                        )
                    {
                        object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad);
                        if (propValue != null)
                        {
                            CProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propValue.ToString(),
                                timeOffset);
                        }
                        else
                        {
                            CProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propertyDefinition.DefaultValue,
                                timeOffset);
                        }
                    }
                    else
                    {
                        if (
                            (propertyDefinition.VisibleToAuthenticated) &&
                            (propertyDefinition.OnlyVisibleForRoles.Length == 0) &&
                            (
                                (propertyDefinition.OnlyAvailableForRoles.Length == 0) ||
                                (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                            )
                            )
                        {
                            wouldSeeMoreIfAuthenticated = true;
                        }
                    }
                }
            }

            if (wouldSeeMoreIfAuthenticated)
            {
                lblMessage.Text = ProfileResource.WouldSeeMoreIfAuthenticatedMessage;
            }
        }
示例#4
0
        private void CreateUser(string windowsLiveId)
        {
            SiteUser newUser = new SiteUser(siteSettings);

            newUser.WindowsLiveId = windowsLiveId;
            newUser.Name          = txtUserName.Text;
            newUser.LoginName     = txtUserName.Text;
            newUser.Email         = txtEmail.Text;
            CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider;

            newUser.Password = CMembership.EncodePassword(SiteUser.CreateRandomPassword(7), siteSettings);
            //newUser.Password = SiteUser.CreateRandomPassword(7);
            newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion;
            newUser.PasswordAnswer   = Resource.ManageUsersDefaultSecurityAnswer;
            newUser.Save();
            if (siteSettings.UseSecureRegistration)
            {
                newUser.SetRegistrationConfirmationGuid(Guid.NewGuid());
            }

            CProfileConfiguration profileConfig
                = CProfileConfiguration.GetConfig();

            // set default values first
            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                CProfilePropertyDefinition.SavePropertyDefault(
                    newUser, propertyDefinition);
            }

            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                if (propertyDefinition.RequiredForRegistration)
                {
                    CProfilePropertyDefinition.SaveProperty(
                        newUser,
                        pnlRequiredProfileProperties,
                        propertyDefinition,
                        timeOffset);
                }
            }

            // track user ip address
            UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address());

            userLocation.SiteGuid = siteSettings.SiteGuid;
            userLocation.Hostname = Page.Request.UserHostName;
            userLocation.Save();

            UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser);

            OnUserRegistered(u);

            CacheHelper.TouchMembershipStatisticsCacheDependencyFile();

            NewsletterHelper.ClaimExistingSubscriptions(newUser);

            DoUserLogin(newUser);
        }
示例#5
0
        private void CreateUser()
        {
            if (SiteUser.EmailExistsInDB(siteSettings.SiteId, txtEmail.Text))
            {
                lblErrorMessage.Text = Resource.DuplicateEmailMessage;
                return;
            }

            if (SiteUser.LoginExistsInDB(siteSettings.SiteId, txtLoginName.Text))
            {
                lblErrorMessage.Text = Resource.DuplicateUserNameMessage;
                return;
            }

            SiteUser user = new SiteUser(siteSettings);

            user.Name      = txtName.Text;
            user.LoginName = txtLoginName.Text;
            user.Email     = txtEmail.Text;

            CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider;

            user.Password = CMembership.EncodePassword(txtPassword.Text, siteSettings);

            if (user.Save())
            {
                user.PasswordQuestion = this.txtPasswordQuestion.Text;
                user.PasswordAnswer   = this.txtPasswordAnswer.Text;
                user.Save();

                CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();
                // set default values
                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    CProfilePropertyDefinition.SavePropertyDefault(user, propertyDefinition);
                }

                CacheHelper.TouchMembershipStatisticsCacheDependencyFile();

                UserRegisteredEventArgs u = new UserRegisteredEventArgs(user);
                OnUserRegistered(u);

                WebUtils.SetupRedirect(this, SiteRoot
                                       + "/Admin/ManageUsers.aspx?userId=" + user.UserId.ToString()
                                       + "&username="******"&pageid=" + pageID);
                return;
            }
        }
示例#6
0
        private void PopulateProfileControls()
        {
            if (siteUser == null)
            {
                return;
            }
            if (!isAdmin)
            {
                return;
            }

            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig != null)
            {
                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (
                        (propertyDefinition.OnlyAvailableForRoles.Length == 0) ||
                        (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                        )
                    {
                        object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad);
                        if (propValue != null)
                        {
                            CProfilePropertyDefinition.SetupPropertyControl(
                                this,
                                pnlProfileProperties,
                                propertyDefinition,
                                propValue.ToString(),
                                TimeOffset,
                                SiteRoot);
                        }
                        else
                        {
                            CProfilePropertyDefinition.SetupPropertyControl(
                                this,
                                pnlProfileProperties,
                                propertyDefinition,
                                propertyDefinition.DefaultValue,
                                TimeOffset,
                                SiteRoot);
                        }
                    }
                }
            }
        }
        private void LoadSettings()
        {
            timeOffset = SiteUtils.GetUserTimeOffset();

            CProfileConfiguration profileConfig
                = CProfileConfiguration.GetConfig();

            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                if (propertyDefinition.RequiredForRegistration)
                {
                    requiredProfileProperties.Add(propertyDefinition);
                }
            }

            openidCookieName         = "openid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);
            openIdEmailCookieName    = "openidemail" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);
            openIdFullNameCookieName = "openidname" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);
        }
        private bool IsValidForUserCreation(OpenIdEventArgs e, ClaimsResponse claim)
        {
            if (e == null)
            {
                return(false);
            }
            if (claim == null)
            {
                return(false);
            }
            if (e.ClaimedIdentifier == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(claim.Email))
            {
                return(false);
            }
            if (String.IsNullOrEmpty(claim.FullName))
            {
                return(false);
            }

            if (!Email.IsValidEmailAddressSyntax(claim.Email))
            {
                return(false);
            }

            // if custom profile fields are required
            // must pass them on to registration page
            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig != null)
            {
                if (profileConfig.HasRequiredCustomProperties())
                {
                    return(false);
                }
            }

            return(true);
        }
        private void ShowAuthenticatedProperties(SiteUser siteUser)
        {
            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig != null)
            {
                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (
                        (propertyDefinition.VisibleToAuthenticated) &&
                        (
                            (propertyDefinition.OnlyAvailableForRoles.Length == 0) ||
                            (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                        ) &&
                        (
                            (propertyDefinition.OnlyVisibleForRoles.Length == 0) ||
                            (WebUser.IsInRoles(propertyDefinition.OnlyVisibleForRoles))
                        )

                        )
                    {
                        object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad);
                        if (propValue != null)
                        {
                            CProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propValue.ToString(),
                                timeOffset);
                        }
                        else
                        {
                            CProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propertyDefinition.DefaultValue,
                                timeOffset);
                        }
                    }
                }
            }
        }
示例#10
0
 private void PopulateRequiredProfileControls()
 {
     if (pnlProfile != null)
     {
         CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();
         if (profileConfig != null)
         {
             foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
             {
                 if (propertyDefinition.RequiredForRegistration)
                 {
                     CProfilePropertyDefinition.SetupPropertyControl(
                         this,
                         pnlProfile,
                         propertyDefinition,
                         timeOffset,
                         SiteRoot);
                 }
             }
         }
     }
 }
示例#11
0
        private void LoadSettings()
        {
            timeOffset = SiteUtils.GetUserTimeOffset();
            if (SiteUtils.SslIsAvailable())
            {
                protocol = "https://";
            }

            CProfileConfiguration profileConfig
                = CProfileConfiguration.GetConfig();

            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                if (propertyDefinition.RequiredForRegistration)
                {
                    requiredProfileProperties.Add(propertyDefinition);
                }
            }

            winliveCookieName = "winliveid" + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);

            windowsLive = WindowsLiveHelper.GetWindowsLiveLogin();
            if (windowsLive == null)
            {
                return;
            }

            windowsLiveAppId = windowsLive.AppId;

            string winLiveToken = CookieHelper.GetCookieValue(winliveCookieName);

            if (winLiveToken.Length > 0)
            {
                liveUser = windowsLive.ProcessToken(winLiveToken);
            }
        }
示例#12
0
        void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            TextBox txtEmail    = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Email");
            TextBox txtUserName = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");

            if (txtEmail == null)
            {
                return;
            }
            if (txtUserName == null)
            {
                return;
            }

            SiteUser siteUser;

            if (siteSettings.UseEmailForLogin)
            {
                siteUser = new SiteUser(siteSettings, txtEmail.Text);
            }
            else
            {
                siteUser = new SiteUser(siteSettings, txtUserName.Text);
            }

            if (siteUser.UserId == -1)
            {
                return;
            }

            if (pnlProfile != null)
            {
                CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

                // set default values first
                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    CProfilePropertyDefinition.SavePropertyDefault(siteUser, propertyDefinition);
                }

                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (propertyDefinition.RequiredForRegistration)
                    {
                        CProfilePropertyDefinition.SaveProperty(
                            siteUser,
                            pnlProfile,
                            propertyDefinition,
                            timeOffset);
                    }
                }
            }


            // track user ip address
            UserLocation userLocation = new UserLocation(siteUser.UserGuid, SiteUtils.GetIP4Address());

            userLocation.SiteGuid = siteSettings.SiteGuid;
            userLocation.Hostname = Page.Request.UserHostName;
            userLocation.Save();

            CacheHelper.TouchMembershipStatisticsCacheDependencyFile();

            if (!siteSettings.UseSecureRegistration)
            {
                if (siteSettings.UseEmailForLogin)
                {
                    FormsAuthentication.SetAuthCookie(
                        siteUser.Email, false);
                }
                else
                {
                    FormsAuthentication.SetAuthCookie(
                        siteUser.LoginName, false);
                }

                if (WebConfigSettings.UseFoldersInsteadOfHostnamesForMultipleSites)
                {
                    string cookieName = "siteguid" + siteSettings.SiteGuid;
                    CookieHelper.SetCookie(cookieName, siteUser.UserGuid.ToString(), false);
                }

                siteUser.UpdateLastLoginTime();
            }



            UserRegisteredEventArgs u = new UserRegisteredEventArgs(siteUser);

            OnUserRegistered(u);
        }
        private void LoadSettings()
        {
            lnkAllUsers.NavigateUrl = SiteRoot + "/MemberList.aspx";

            allowView = WebUser.IsInRoles(siteSettings.RolesThatCanViewMemberList);

            if (WebUser.IsAdmin)
            {
                IsAdmin             = true;
                canManageUsers      = true;
                spnIPLookup.Visible = true;
            }
            else
            {
                canManageUsers = WebUser.IsInRoles(siteSettings.RolesThatCanManageUsers);
            }

            if (IsAdmin || canManageUsers)
            {
                lnkNewUser.Visible     = true;
                lnkNewUser.Text        = Resource.MemberListAddUserLabel;
                lnkNewUser.NavigateUrl = SiteRoot + "/Admin/ManageUsers.aspx?userId=-1";
            }

            pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", 1);

            if (Request.Params["letter"] != null)
            {
                userNameBeginsWith = Request.Params["letter"].Trim();
            }

            if (Request.Params["search"] != null)
            {
                searchText = Request.Params["search"].Trim();
            }


            pageSize = WebConfigSettings.MemberListPageSize;

            CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

            if (profileConfig != null)
            {
                if (profileConfig.Contains("WebSiteUrl"))
                {
                    CProfilePropertyDefinition webSiteUrlProperty = profileConfig.GetPropertyDefinition("WebSiteUrl");
                    if (
                        (webSiteUrlProperty.OnlyVisibleForRoles.Length == 0) ||
                        (WebUser.IsInRoles(webSiteUrlProperty.OnlyVisibleForRoles))
                        )
                    {
                        ShowWebSiteColumn = true;
                    }
                }
            }

            if (!ShowWebSiteColumn)
            {
                //thTitle.ColSpan = 4;
                //divNewUser.ColSpan = 4;
                //tdModulePager.ColSpan = 4;
                thWebLink.Visible = false;
            }

            if (WebConfigSettings.UseRelatedSiteMode)
            {
                // this can't be used in related site mode
                // because we can't assume group posts were in this site.
                ShowGroupPostColumn = false;
            }
        }
示例#14
0
        private void UpdateUser()
        {
            if (siteUser == null)
            {
                return;
            }


            if (
                (siteUser.Email != txtEmail.Text) &&
                (SiteUser.EmailExistsInDB(siteSettings.SiteId, txtEmail.Text))
                )
            {
                lblErrorMessage.Text = Resource.DuplicateEmailMessage;
                return;
            }

            if (
                (siteUser.LoginName != txtLoginName.Text) &&
                (SiteUser.LoginExistsInDB(siteSettings.SiteId, txtLoginName.Text))
                )
            {
                lblErrorMessage.Text = Resource.DuplicateUserNameMessage;
                return;
            }

            siteUser.Name      = txtName.Text;
            siteUser.LoginName = txtLoginName.Text;
            siteUser.Email     = txtEmail.Text;

            if (divOpenID.Visible)
            {
                siteUser.OpenIdUri = txtOpenIDURI.Text;
            }

            if (!siteSettings.UseLdapAuth)
            {
                if (txtPassword.Text.Length > 0)
                {
                    CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider;
                    siteUser.Password = CMembership.EncodePassword(txtPassword.Text, siteSettings);
                }
            }

            siteUser.ProfileApproved     = chkProfileApproved.Checked;
            siteUser.ApprovedForGroups   = chkApprovedForGroups.Checked;
            siteUser.Trusted             = chkTrusted.Checked;
            siteUser.DisplayInMemberList = chkDisplayInMemberList.Checked;
            //siteUser.AvatarUrl = ddAvatars.SelectedValue;

            // this could also be in profile system
            siteUser.Comment                      = this.txtComment.Text;
            siteUser.PasswordQuestion             = this.txtPasswordQuestion.Text;
            siteUser.PasswordAnswer               = this.txtPasswordAnswer.Text;
            siteUser.WindowsLiveId                = txtWindowsLiveID.Text;
            siteUser.LiveMessengerId              = txtLiveMessengerCID.Text;
            siteUser.EnableLiveMessengerOnProfile = chkEnableLiveMessengerOnProfile.Checked;

            if (siteUser.Save())
            {
                CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    CProfilePropertyDefinition.SaveProperty(
                        siteUser,
                        pnlProfileProperties,
                        propertyDefinition,
                        TimeOffset);
                }


                if ((currentUser != null) && (currentUser.UserId == siteUser.UserId))
                {
                    if ((siteSettings.UseEmailForLogin) && (siteUser.Email != currentUser.Email))
                    {
                        FormsAuthentication.SetAuthCookie(siteUser.Email, false);
                    }

                    if ((!siteSettings.UseEmailForLogin) && (siteUser.LoginName != currentUser.LoginName))
                    {
                        FormsAuthentication.SetAuthCookie(siteUser.LoginName, false);
                    }
                }

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
        }
        private void CreateUser(
            string openId,
            string email,
            string loginName,
            string name)
        {
            SiteUser newUser = new SiteUser(siteSettings);

            newUser.Email = email;

            if (loginName.Length > 50)
            {
                loginName = loginName.Substring(0, 50);
            }

            int i = 1;

            while (SiteUser.LoginExistsInDB(
                       siteSettings.SiteId, loginName))
            {
                loginName += i.ToString();
                if (loginName.Length > 50)
                {
                    loginName = loginName.Remove(40, 1);
                }
                i++;
            }
            if ((name == null) || (name.Length == 0))
            {
                name = loginName;
            }
            newUser.LoginName = loginName;
            newUser.Name      = name;
            //newUser.Password = SiteUser.CreateRandomPassword(7);
            CMembershipProvider CMembership = (CMembershipProvider)Membership.Provider;

            newUser.Password         = CMembership.EncodePassword(SiteUser.CreateRandomPassword(7), siteSettings);
            newUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion;
            newUser.PasswordAnswer   = Resource.ManageUsersDefaultSecurityAnswer;
            newUser.OpenIdUri        = openId;
            newUser.Save();
            if (siteSettings.UseSecureRegistration)
            {
                newUser.SetRegistrationConfirmationGuid(Guid.NewGuid());
            }

            CProfileConfiguration profileConfig
                = CProfileConfiguration.GetConfig();

            // set default values first
            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                CProfilePropertyDefinition.SavePropertyDefault(
                    newUser, propertyDefinition);
            }

            foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
            {
                if (propertyDefinition.RequiredForRegistration)
                {
                    CProfilePropertyDefinition.SaveProperty(
                        newUser,
                        pnlRequiredProfileProperties,
                        propertyDefinition,
                        timeOffset);
                }
            }

            // track user ip address
            UserLocation userLocation = new UserLocation(newUser.UserGuid, SiteUtils.GetIP4Address());

            userLocation.SiteGuid = siteSettings.SiteGuid;
            userLocation.Hostname = Page.Request.UserHostName;
            userLocation.Save();

            UserRegisteredEventArgs u = new UserRegisteredEventArgs(newUser);

            OnUserRegistered(u);

            CacheHelper.TouchMembershipStatisticsCacheDependencyFile();

            NewsletterHelper.ClaimExistingSubscriptions(newUser);

            DoUserLogin(newUser);
        }
示例#16
0
        private void UpdateUser()
        {
            userEmail = siteUser.Email;

            if (
                (siteUser.Email != txtEmail.Text) &&
                (SiteUser.EmailExistsInDB(siteSettings.SiteId, txtEmail.Text))
                )
            {
                lblErrorMessage.Text = Resource.DuplicateEmailMessage;
                return;
            }

            siteUser.Name  = txtName.Text;
            siteUser.Email = txtEmail.Text;
            if (pnlSecurityQuestion.Visible)
            {
                siteUser.PasswordQuestion = this.txtPasswordQuestion.Text;
                siteUser.PasswordAnswer   = this.txtPasswordAnswer.Text;
            }
            else
            {
                //in case it is ever changed later to require password question and answer after making it not required
                // we need to ensure there is some question and answer.
                if (siteUser.PasswordQuestion.Length == 0)
                {
                    siteUser.PasswordQuestion = Resource.ManageUsersDefaultSecurityQuestion;
                    siteUser.PasswordAnswer   = Resource.ManageUsersDefaultSecurityAnswer;
                }
            }


            if (siteUser.LiveMessengerId.Length > 0)
            {
                siteUser.EnableLiveMessengerOnProfile = chkEnableLiveMessengerOnProfile.Checked;
            }
            else
            {
                siteUser.EnableLiveMessengerOnProfile = false;
            }

            if (siteSettings.AllowUserSkins)
            {
                if (ddSkins.SelectedValue != "printerfriendly")
                {
                    siteUser.Skin = ddSkins.SelectedValue;
                }
            }

            //if ((!disableOldAvatars)&&(!WebConfigSettings.OnlyAdminsCanEditCheesyAvatars))
            //{ siteUser.AvatarUrl = ddAvatars.SelectedValue; }

            if (siteUser.Save())
            {
                CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig();

                foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (
                        (propertyDefinition.EditableByUser) &&
                        (
                            (propertyDefinition.OnlyAvailableForRoles.Length == 0) ||
                            (WebUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                        )
                        )
                    {
                        CProfilePropertyDefinition.SaveProperty(
                            siteUser,
                            pnlProfileProperties,
                            propertyDefinition,
                            timeOffset);
                    }
                }

                siteUser.UpdateLastActivityTime();
                if ((userEmail != siteUser.Email) && (siteSettings.UseEmailForLogin))
                {
                    FormsAuthentication.SetAuthCookie(siteUser.Email, false);
                }

                SiteUtils.SetSkinCookie(siteUser);
                WebUtils.SetupRedirect(this, Request.RawUrl);
                return;
            }
        }