public async Task <IActionResult> ConfirmEmailCreateMailMessage(CreateEmailMessageViewModel model) { var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { throw new ApplicationException($"Unable to load user with Mail '{model.Email}'."); } return(await _confirmEmailCreateMailMessage(user)); }
public async Task <IActionResult> UpdateCreateEmailMessageViewModel(CreateEmailMessageViewModel model) { var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { throw new ApplicationException($"Unable to load user with Mail '{model.Email}'."); } model.EmailReadOnly = false; return(View("ConfirmEmailError", model)); }
public async Task <IActionResult> ConfirmEmailChangeRegistredEmail(CreateEmailMessageViewModel model) { if (ModelState.IsValid) { var user = await _userManager.FindByNameAsync(model.UserName); if (user == null) { throw new ApplicationException($"Unable to load user with Mail '{model.Email}'."); } user.Email = model.Email; var result = await _userManager.UpdateAsync(user); if (result.Succeeded) { return(await _confirmEmailCreateMailMessage(user)); } AddErrors(result); } return(View("ConfirmEmailError", model)); }