Example #1
0
 public virtual MvcMailMessage PasswordResetMessage(EmailPasswordResetModel model)
 {
     ViewData.Model = model;
     return Populate(x =>
     {
         x.Subject = "Password Reset Request";
         x.ViewName = "PasswordResetRequest";
         x.To.Add(model.ToEmail);
     });
 }
        public ActionResult SendPasswordResetEmail(string username, string token)
        {
            Account account = AccountRepos.Get(username);
            EmailPasswordResetModel model = new EmailPasswordResetModel()
            {
                SiteName = siteName,
                SiteUrl = siteUrl,
                FirstName = account.FirstName,
                UserName = account.UserName,
                ToEmail = account.Email,
                PasswordResetToken = token,
                PasswordResetUrl = siteUrl + "/Account/ChangePassword?u=" + account.UserName + @"&t=" + token
            };

            UserMailer mailer = new UserMailer();
            mailer.PasswordResetMessage(model).Send();
            return RedirectToAction("RequestChangePasswordSuccess", "Account");
        }