public virtual ActionResult ChangePasswordForm(string view = "")
 {
     var model = new ChangePasswordModel();
     return view.IsNullOrWhiteSpace() ? PartialView(model) : PartialView(view, model);
 }
        public virtual ActionResult ChangePassword(ChangePasswordModel model)
        {
            if (!ModelState.IsValid) return CurrentUmbracoPage();
            var viewData = new StoreViewData();

            if (!((model.Password.Length >= Membership.MinRequiredPasswordLength) &&
                (model.Password.ToCharArray().Count(c => !char.IsLetterOrDigit(c)) >= Membership.MinRequiredNonAlphanumericCharacters)))
            {
                viewData.Success = false;
                viewData.Messages = new[] { string.Format("New password invalid. Minimum length {0} characters", Membership.MinRequiredPasswordLength) };
                ViewData["MerchelloViewData"] = viewData;
                return CurrentUmbracoPage();
            }

            // change password seems to have a bug that will allow it to change the password even if the supplied
            // old password is wrong!
            // so use the login to check the old password as a hack
            var currentUser = Membership.GetUser();
            if (!Members.Login(currentUser.UserName, model.OldPassword))
            {
                viewData.Success = false;
                viewData.Messages = new[] { "Current password incorrect." };
                ViewData["MerchelloViewData"] = viewData;
                return CurrentUmbracoPage();
            }

            if (!currentUser.ChangePassword(model.OldPassword, model.Password))
            {
                viewData.Success = false;
                viewData.Messages = new[] { "Change password failed. Please try again." };
                ViewData["MerchelloViewData"] = viewData;
                return CurrentUmbracoPage();
            }

            viewData.Success = true;
            viewData.Messages = new[] { "Password updated successfully" };
            ViewData["MerchelloViewData"] = viewData;
            return CurrentUmbracoPage();
        }