public void ChangePassword()
        {
            var memberId = this.RequestUserInput<string>("Enter member ID: ", string.Empty);
            var currentPassword = this.RequestUserInput<string>("Enter current password: "******"Enter new password: "******"Re-enter new password: ", string.Empty);

            var request = new ChangePasswordRequest
            {
                MemberId = memberId,
                CurrentPassword = currentPassword,
                Password = password,
                PasswordConfirm = passwordConfirm
            };

            var response = proxy.ChangePassword(request);

            this.OutputResponse(response);
        }
        public IHttpActionResult ChangePassword(ChangePasswordRequest request)
        {
            var response = new ChangePasswordResponse();

            try
            {
                var isValidRequest = false;

                var memberId = request.GetMemberId();
                var member = MembershipAdapter.GetMember(memberId);

                if (request.IsValidModel())
                {
                    if (!request.PasswordsMatch())
                    {
                        request.AddError("Password", "Passwords do not match");
                    }
                }

                if (member.Authenticate(request.CurrentPassword))
                {
                    if (!request.HasErrors())
                    {
                        isValidRequest = true;
                    }
                }
                else
                {
                    request.AddError("Current password", "Current password is invalid");
                }

                if (isValidRequest)
                {
                    var memberPassword = new MemberPassword();

                    memberPassword.MemberId = member.Id;
                    memberPassword.InitializePassword(request.Password);

                    memberPassword = MembershipAdapter.UpdatePassword(memberPassword);

                    var email = new ChangePasswordEmail
                    {
                        DomainName = ConfigHelper.DomainName,
                        DomainBaseUrl = ConfigHelper.DomainBaseUrl,
                        Alias = member.Profile.Alias
                    };

                    var emailBuilder = new EmailBuilder(EmailReference.HTML.Templates.Main, EmailReference.HTML.Contents.ChangePassword);
                    var emailBody = emailBuilder.BuildBody<ChangePasswordEmail>(email);
                    var emailResult = EmailHelper.SendEmail(ConfigHelper.NoReplayEmailAddress,
                                                            ConfigHelper.DomainName,
                                                            member.Email,
                                                            member.Profile.Alias,
                                                            email.Subject,
                                                            emailBody,
                                                            true);

                    if (emailResult)
                    {
                        response.IsSuccessful = true;
                        response.StatusMessage = "Password update succeeded";
                    }
                }
                else
                {
                    response.IsSuccessful = false;
                    response.StatusMessage = "Password update was unsuccessful";
                    response.Errors.AddRange(request.GetErrors());
                }
            }
            catch (Exception ex)
            {
                request.CurrentPassword = string.Empty;
                request.Password = string.Empty;
                request.PasswordConfirm = string.Empty;

                this.Log<ChangePasswordRequest>(LogCategories.Error, request, ex.Message);

                response.IsSuccessful = false;
                response.StatusMessage = this.StatusMessageForExpection;
                response.Errors.Add(ex.Message);
            }

            return Ok(response);
        }