/// <summary>
        /// Resets the user password.
        /// </summary>
        /// <param name="storefront">The storefront.</param>
        /// <param name="inputModel">The input model.</param>
        /// <returns>The manager response.</returns>
        public virtual ManagerResponse<UpdatePasswordResult, bool> ResetUserPassword([NotNull] CommerceStorefront storefront, ForgotPasswordInputModel inputModel)
        {
            Assert.ArgumentNotNull(storefront, "storefront");
            Assert.ArgumentNotNull(inputModel, "inputModel");
            Assert.ArgumentNotNullOrEmpty(inputModel.Email, "inputModel.Email");

            var result = new UpdatePasswordResult { Success = true };

            var getUserResponse = this.GetUser(inputModel.Email);
            if (!getUserResponse.ServiceProviderResult.Success || getUserResponse.Result == null)
            {
                result.Success = false;
                foreach (var systemMessage in getUserResponse.ServiceProviderResult.SystemMessages)
                {
                    result.SystemMessages.Add(systemMessage);
                }
            }
            else
            {
                try
                {
                    var userIpAddress = HttpContext.Current != null ? HttpContext.Current.Request.UserHostAddress : string.Empty;
                    string provisionalPassword = Membership.Provider.ResetPassword(getUserResponse.Result.UserName, string.Empty);

                    var mailUtil = new MailUtil();
                    var wasEmailSent = mailUtil.SendMail("ForgotPassword", inputModel.Email, storefront.SenderEmailAddress, new object(), new object[] { userIpAddress, provisionalPassword });
                    if (!wasEmailSent)
                    {
                        var message = StorefrontManager.GetSystemMessage("CouldNotSentEmailError");
                        result.Success = false;
                        result.SystemMessages.Add(new SystemMessage { Message = message });
                    }
                }
                catch (Exception e)
                {
                    result.Success = false;
                    result.SystemMessages.Add(new SystemMessage { Message = e.Message });
                }

                if (!result.Success)
                {
                    Helpers.LogSystemMessages(result.SystemMessages, result);
                }
            }

            return new ManagerResponse<UpdatePasswordResult, bool>(result, result.Success);
        }
        public JsonResult ForgotPassword(ForgotPasswordInputModel model)
        {
            try
            {
                Assert.ArgumentNotNull(model, "model");
                ForgotPasswordBaseJsonResult result = new ForgotPasswordBaseJsonResult();

                this.ValidateModel(result);
                if (result.HasErrors)
                {
                    return Json(result, JsonRequestBehavior.AllowGet);
                }

                var resetResponse = this.AccountManager.ResetUserPassword(this.CurrentStorefront, model);
                if (!resetResponse.ServiceProviderResult.Success)
                {
                    return Json(new ForgotPasswordBaseJsonResult(resetResponse.ServiceProviderResult));
                }

                result.Initialize(model.Email);
                return Json(result, JsonRequestBehavior.AllowGet);
            }
            catch (Exception e)
            {
                CommerceLog.Current.Error("ForgotPassword", this, e);
                return Json(new BaseJsonResult("ForgotPassword", e), JsonRequestBehavior.AllowGet);
            }
        }