示例#1
0
        public void SendEmailTest()
        {
            User user = _mockUserRepo.FindByEmail("*****@*****.**");

            Assert.IsNotNull(user);

            IEmailService emailService = new EmailService();
            string        token        = passResetTokenService.GenerateToken(user);

            emailService.SendEmail(new MailMessage("*****@*****.**", "*****@*****.**", "Password Reset", token));

            Assert.IsNotEmpty(token);
        }
示例#2
0
        public ActionResult ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = userService.Find(model.Email);
                if (user == null)
                {
                    return(View("ResetPasswordConfirmation"));
                }

                string token = passResetTokenService.GenerateToken(user);
                emailService.SendEmail(new MailMessage("*****@*****.**", model.Email, "Password Reset", token));

                return(RedirectToAction("ForgotPasswordConfirmation", "Account"));
            }

            return(View(model));
        }