コード例 #1
0
        public ActionResult ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var customer = _customerService.GetCustomerByEmail(model.Email);
                if (customer != null && customer.Active && !customer.Deleted)
                {
                    //save token and current date
                    var passwordRecoveryToken = Guid.NewGuid().ToString();
                    customer.PasswordRecoveryToken = passwordRecoveryToken;
                    _customerService.UpdateCustomer(customer);

                    //send email
                    _workflowMessageService.SendCustomerPasswordRecoveryMessage(customer);

                    model.Result = "Email with instructions has been sent to you. ";
                }
                else
                {
                    model.Result = "Email not found. ";
                }

                return View(model);
            }

            //If we got this far, something failed, redisplay form
            return View(model);
        }
コード例 #2
0
 public ActionResult ForgotPassword()
 {
     ForgotPasswordViewModel model = new ForgotPasswordViewModel();
     return View(model);
 }