Exemplo n.º 1
0
 protected void OnUserUpdated(ProfileUpdatedEventArgs e)
 {
     foreach (ProfileUpdatedHandlerProvider handler in ProfileUpdatedHandlerProviderManager.Providers)
     {
         handler.ProfileUpdatedHandler(null, e);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Raise a profile updated event.
        /// </summary>
        protected void OnProfileUpdated(ProfileUpdatedEventArgs e)
        {
            TraceHelper.Trace();

            if (profileUpdated != null)
            {
                profileUpdated(this, e);
            }
        }
        private void ProfileUpdated(object sender, ProfileUpdatedEventArgs e)
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            Type serviceType = sender.GetType();

            if (null == e.WorkflowType)
            {
                throw new ArgumentNullException("e");
            }
            if (e.TrackingProfile == null)
            {
                this.RemoveProfile(e.WorkflowType, serviceType);
            }
            else
            {
                RTTrackingProfile profile = this.CreateProfile(e.TrackingProfile, e.WorkflowType, serviceType);
                this.AddToCache(profile, serviceType, true);
            }
        }
Exemplo n.º 4
0
        private void UpdateUser()
        {
            userEmail = siteUser.Email;

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

            if ((siteSettings.AllowUserEditorPreference) && (divEditorPreference.Visible))
            {
                siteUser.EditorPreference = ddEditorProviders.SelectedValue;
            }

            if (siteSettings.AllowUserFullNameChange)
            {
                siteUser.Name = txtName.Text;
            }
            siteUser.Email = txtEmail.Text;

            if (WebConfigSettings.LogIpAddressForEmailChanges)
            {
                if ((siteUser.UserId != -1) && (userEmail != siteUser.Email))
                {
                    log.Info("email for user changed from " + userEmail + " to " + siteUser.Email + " from ip address " + SiteUtils.GetIP4Address());
                }
            }

            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 (allowUserSkin)
            {
                siteUser.Skin = SkinSetting.GetValue();
                //if (ddSkins.SelectedValue != "printerfriendly")
                //{
                //    siteUser.Skin = ddSkins.SelectedValue;
                //}
            }

#if !MONO
            ISettingControl setting = timeZoneSetting as ISettingControl;
            if (setting != null)
            {
                siteUser.TimeZoneId = setting.GetValue();
            }
#endif

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

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

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

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

                ProfileUpdatedEventArgs u = new ProfileUpdatedEventArgs(siteUser, false);
                OnUserUpdated(u);

                SiteUtils.SetSkinCookie(siteUser);
                WebUtils.SetupRedirect(this, Request.RawUrl);
                return;
            }
        }
Exemplo n.º 5
0
        private void UpdateUser()
        {
            userEmail = siteUser.Email;

            if (
                (siteUser.Email != txtEmail.Text) &&
                (SiteUser.EmailExistsInDB(siteSettings.SiteId, txtEmail.Text))
                )
            {
                message.ErrorMessage = ResourceHelper.GetResourceString("Resource", "DuplicateEmailMessage");
                return;
            }

            if ((siteSettings.AllowUserEditorPreference) && (divEditorPreference.Visible))
            {
                siteUser.EditorPreference = ddEditorProviders.SelectedValue;
            }

            if (siteSettings.AllowUserFullNameChange)
            {
                siteUser.Name = txtName.Text;
            }
            siteUser.Email = txtEmail.Text;

            if (WebConfigSettings.LogIpAddressForEmailChanges)
            {
                if ((siteUser.UserId != -1) && (userEmail != siteUser.Email))
                {
                    log.Info("email for user changed from " + userEmail + " to " + siteUser.Email + " from ip address " + SiteUtils.GetIP4Address());
                }
            }

            if (pnlSecurityQuestion.Visible)
            {
                siteUser.PasswordQuestion = this.txtPasswordQuestion.Text;
                siteUser.PasswordAnswer   = this.txtPasswordAnswer.Text;
            }
            else
            {
                if (siteUser.PasswordQuestion.Length == 0)
                {
                    siteUser.PasswordQuestion = ResourceHelper.GetResourceString("Resource", "ManageUsersDefaultSecurityQuestion");
                    siteUser.PasswordAnswer   = ResourceHelper.GetResourceString("Resource", "ManageUsersDefaultSecurityAnswer");
                }
            }

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

#if !MONO
            ISettingControl setting = timeZoneSetting as ISettingControl;
            if (setting != null)
            {
                siteUser.TimeZoneId = setting.GetValue();
            }
#endif

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

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

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

                ProfileUpdatedEventArgs u = new ProfileUpdatedEventArgs(siteUser, false);
                OnUserUpdated(u);

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