public ActionResult ForgotPassword(ForgotPasswordViewModel model) { var changePasswordSucceeded = true; var newPassword = MembershipHelper.GeneratePassword(); try { if (ModelState.IsValid) { var currentUser = MembershipHelper.MapMember(Services.MemberService.GetByEmail(model.EmailAddress)); if (currentUser != null) { changePasswordSucceeded = MembershipHelper.ResetPassword(currentUser, newPassword); } else { changePasswordSucceeded = false; } } } catch (Exception ex) { LogHelper.Error <LoginRegisterController>(string.Format("Error resetting password for {0}", model.EmailAddress), ex); changePasswordSucceeded = false; } if (changePasswordSucceeded) { // ToDo: Send email. //var sb = new StringBuilder(); //sb.AppendFormat("<p>{0}</p>", Umbraco.GetDictionaryValue("Members.ForgotPassword.Email")); //sb.AppendFormat("<p><b>{0}</b></p>", newPassword); //var email = new Email //{ // EmailFrom = Constants.DefaultEmailAddress, // EmailTo = currentUser.Email, // NameTo = currentUser.UserName, // Subject = Umbraco.GetDictionaryValue("Members.ForgotPassword.Subject") //}; //email.Body = ServiceFactory.EmailService.EmailTemplate(email.NameTo, sb.ToString()); //ServiceFactory.EmailService.SendMail(email); // We use temp data because we are doing a redirect var payload = new PayloadResult(); payload.SetMessage(Umbraco.GetDictionaryValue("Members.ForgotPassword.SuccessMessage", "Members.ForgotPassword.SuccessMessage")); payload.SetMessageType(GenericMessages.Success); ShowMessage(new PayloadResult(Umbraco.GetDictionaryValue("Members.ForgotPassword.SuccessMessage"), GenericMessages.Success)); return(CurrentUmbracoPage()); } ModelState.AddModelError(string.Empty, Umbraco.GetDictionaryValue("Members.ForgotPassword.ErrorMessage")); return(CurrentUmbracoPage()); }