/// <summary> /// This handles changing the password /// </summary> /// <param name="passwordChangerControl"></param> /// <param name="membershipUser"></param> /// <param name="passwordChangerValidator"></param> private void ChangePassword(passwordChanger passwordChangerControl, MembershipUser membershipUser, CustomValidator passwordChangerValidator) { if (passwordChangerControl.IsChangingPassword) { //SD: not sure why this check is here but must have been for some reason at some point? if (string.IsNullOrEmpty(passwordChangerControl.ChangingPasswordModel.NewPassword) == false) { // make sure password is not empty if (string.IsNullOrEmpty(u.Password)) { u.Password = "******"; } } var changePasswordModel = passwordChangerControl.ChangingPasswordModel; //now do the actual change var changePassResult = _membershipHelper.ChangePassword( membershipUser.UserName, changePasswordModel, BackOfficeProvider); if (changePassResult.Success) { //if it is successful, we need to show the generated password if there was one, so set //that back on the control passwordChangerControl.ChangingPasswordModel.GeneratedPassword = changePassResult.Result.ResetPassword; } else { passwordChangerValidator.IsValid = false; passwordChangerValidator.ErrorMessage = changePassResult.Result.ChangeError.ErrorMessage; passw.Controls[1].Visible = true; } } }