Exemplo n.º 1
0
        public ActionResult Confirm(EmailConfirmationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var user = userService.GetUserByNewEmail(model.Email);
            if (user == null)
            {
                ModelState.AddModelError("Confirmation", "We were unable to find a user that matches this email address.");
                return View(model);
            }

            if(!user.ConfirmEmail(model.Password, model.Email, model.ConfirmationKey))
            {
                ModelState.AddModelError("Confirmation", "We were unable to find a user that matches this email address.");
                return View(model);
            }

            // save confirmation
            unitOfWork.Save();
            this.TempData.AddAlert("Your sendEmail has been confirmed.");
            return RedirectToAction("LogIn");
        }
Exemplo n.º 2
0
 public ViewResult Confirm(string id)
 {
     var model = new EmailConfirmationViewModel { ConfirmationKey = id };
     return View(model);
 }