public void Should_have_error_when_email_is_null_or_empty()
 {
     var model = new PasswordRecoveryModel();
     model.Email = null;
     _validator.ShouldHaveValidationErrorFor(x => x.Email, model);
     model.Email = "";
     _validator.ShouldHaveValidationErrorFor(x => x.Email, model);
 }
 public ActionResult PasswordRecovery()
 {
     var model = new PasswordRecoveryModel();
     return View(model);
 }
        public ActionResult PasswordRecoverySend(PasswordRecoveryModel model)
        {
            if (ModelState.IsValid)
            {
                var customer = _customerService.GetCustomerByEmail(model.Email);
                if (customer != null && customer.Active && !customer.Deleted)
                {
                    var passwordRecoveryToken = Guid.NewGuid();
                    _genericAttributeService.SaveAttribute(customer, SystemCustomerAttributeNames.PasswordRecoveryToken, passwordRecoveryToken.ToString());
                    _workflowMessageService.SendCustomerPasswordRecoveryMessage(customer, _workContext.WorkingLanguage.Id);

                    model.Result = _localizationService.GetResource("Account.PasswordRecovery.EmailHasBeenSent");
                }
                else
                    model.Result = _localizationService.GetResource("Account.PasswordRecovery.EmailNotFound");

                return View(model);
            }

            //If we got this far, something failed, redisplay form
            return View(model);
        }
 public void Should_not_have_error_when_email_is_correct_format()
 {
     var model = new PasswordRecoveryModel();
     model.Email = "*****@*****.**";
     _validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
 }