public async Task <IActionResult> ConfirmEmail(int userId, string token, string returnUrl) { ApplicationUser user = await _userManager.FindByIdAsync(userId.ToString()); if (user == null) { return(RedirectToAction(nameof(AccountController.Login))); } IdentityResult confirmEmailResult = await _userManager.ConfirmEmailAsync(user, token); if (!confirmEmailResult.Succeeded) { return(RedirectToAction(nameof(AccountController.Login))); } await CreateRequiredDataAsync(user.Id); await CreateSamplesAsync(user.Id); // Notify admin _ = _emailTemplateService.EnqueueNewEmailVerificationEmailAsync(user.Name, user.Email); return(RedirectToAction(nameof(AccountController.Login), new { returnUrl, alert = LoginAlert.RegistrationConfirmed })); }