protected void OnUserUpdated(ProfileUpdatedEventArgs e) { foreach (ProfileUpdatedHandlerProvider handler in ProfileUpdatedHandlerProviderManager.Providers) { handler.ProfileUpdatedHandler(null, e); } }
public override void ProfileUpdatedHandler(object sender, ProfileUpdatedEventArgs e) { //if (sender == null) return; if (e == null) return; if (e.SiteUser == null) return; // do nothing if (e.UpdatedByAdmin) { log.Debug("DoNothingProfileUpdatedHandler called - an admin updated user " + e.SiteUser.Email); } else { log.Debug("DoNothingProfileUpdatedHandler called for user " + e.SiteUser.Email); } }
public override void ProfileUpdatedHandler(object sender, ProfileUpdatedEventArgs e) { //if (sender == null) return; if (e == null) { return; } if (e.SiteUser == null) { return; } // do nothing if (e.UpdatedByAdmin) { log.Debug("DoNothingProfileUpdatedHandler called - an admin updated user " + e.SiteUser.Email); } else { log.Debug("DoNothingProfileUpdatedHandler called for user " + e.SiteUser.Email); } }
public abstract void ProfileUpdatedHandler( object sender, ProfileUpdatedEventArgs e);
public abstract void ProfileUpdatedHandler( object sender, ProfileUpdatedEventArgs e);
private void UpdateUser() { if (siteUser == null) { return; } if ( (siteUser.Email != txtEmail.Text) && (SiteUser.EmailExistsInDB(siteSettings.SiteId, siteUser.UserId, txtEmail.Text)) ) { lblErrorMessage.Text = Resource.DuplicateEmailMessage; return; } if ( (siteUser.LoginName != txtLoginName.Text) && (SiteUser.LoginExistsInDB(siteSettings.SiteId, txtLoginName.Text)) ) { lblErrorMessage.Text = Resource.DuplicateUserNameMessage; return; } string oldEmail = siteUser.Email; siteUser.Name = txtName.Text; siteUser.LoginName = txtLoginName.Text; siteUser.Email = txtEmail.Text; if (WebConfigSettings.LogIpAddressForEmailChanges) { if ((siteUser.UserId != -1) && (oldEmail != siteUser.Email)) { log.Info("email for user changed from " + oldEmail + " to " + siteUser.Email + " from ip address " + SiteUtils.GetIP4Address()); } } if (divOpenID.Visible) { siteUser.OpenIdUri = txtOpenIDURI.Text; } string oldPassword = siteUser.Password; if (!siteSettings.UseLdapAuth || (siteSettings.UseLdapAuth && siteSettings.AllowDbFallbackWithLdap)) { if (txtPassword.Text.Length > 0) { mojoMembershipProvider mojoMembership = (mojoMembershipProvider) Membership.Provider; siteUser.Password = mojoMembership.EncodePassword(siteSettings, siteUser, txtPassword.Text); } } if (WebConfigSettings.LogIpAddressForPasswordChanges) { if((siteUser.UserId != -1)&&(oldPassword != siteUser.Password)) { log.Info("password for user " + siteUser.Name + " was changed by an admin user from ip address " + SiteUtils.GetIP4Address()); } } siteUser.ProfileApproved = chkProfileApproved.Checked; siteUser.Trusted = chkTrusted.Checked; siteUser.DisplayInMemberList = chkDisplayInMemberList.Checked; //siteUser.AvatarUrl = ddAvatars.SelectedValue; siteUser.MustChangePwd = chkRequirePasswordChange.Checked; siteUser.Comment = txtComment.Text; siteUser.PasswordQuestion = txtPasswordQuestion.Text; siteUser.PasswordAnswer = txtPasswordAnswer.Text; siteUser.PasswordFormat = siteSettings.PasswordFormat; siteUser.WindowsLiveId = txtWindowsLiveID.Text; siteUser.LiveMessengerId = txtLiveMessengerCID.Text; siteUser.EnableLiveMessengerOnProfile = chkEnableLiveMessengerOnProfile.Checked; if ((siteSettings.AllowUserEditorPreference) && (divEditorPreference.Visible)) { siteUser.EditorPreference = ddEditorProviders.SelectedValue; } #if!MONO ISettingControl setting = timeZoneSetting as ISettingControl; if (setting != null) { siteUser.TimeZoneId = setting.GetValue(); } #endif if (siteUser.Save()) { mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig(); foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { mojoProfilePropertyDefinition.SaveProperty( siteUser, pnlProfileProperties, propertyDefinition, TimeOffset, timeZone); } 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); } } ProfileUpdatedEventArgs u = new ProfileUpdatedEventArgs(siteUser, true); OnUserUpdated(u); WebUtils.SetupRedirect(this, Request.RawUrl); } }
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; } }