public async Task <ActionResult> ResendInvitation(ResendInvitationViewModel model) { if (!ModelState.IsValid) { return(View(model)); } try { var user = await userManager.FindByEmailAsync(model.Email); if (user == null) { throw new ArgumentException("No such user"); } await SendNotificationEmail(user.Id, model.Email); } catch (Exception e) { ModelState.AddModelError(nameof(model.Email), e.Message); return(View(model)); } return(View("ReplacementToken")); }
public async Task <ActionResult> ReplacementToken(ResendInvitationViewModel model) { var forgotModel = new ForgotViewModel { Email = model.Email }; if (!ModelState.IsValid) { return(View("TokenExpired", forgotModel)); } try { var user = await userManager.FindByEmailAsync(model.Email); await SendNotificationEmail(user.Id, model.Email); return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); return(View(forgotModel)); } }