public ActionResult Confirm(string id) { var account = this.userAccountService.GetByVerificationKey(id); if (account == null) return View("Error"); if (account.HasPassword()) { var vm = new ChangeEmailFromKeyInputModel(); vm.Key = id; return View("Confirm", vm); } else { try { userAccountService.VerifyEmailFromKey(id, out account); // since we've changed the email, we need to re-issue the cookie that // contains the claims. authSvc.SignIn(account); return RedirectToAction("Success"); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } return View("Confirm", null); } }
public ActionResult Confirm(ChangeEmailFromKeyInputModel model) { if (ModelState.IsValid) { try { NhUserAccount account; this.userAccountService.VerifyEmailFromKey(model.Key, model.Password, out account); // since we've changed the email, we need to re-issue the cookie that // contains the claims. authSvc.SignIn(account); return RedirectToAction("Success"); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } } return View("Confirm", model); }