public async Task <IActionResult> ConfirmEmail(ConfirmEmailViewModel confirmEmail) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(ResponseBadRequest()); } var user = await _accessManager.GetUserByUsername(confirmEmail.Username); if (user == null) { NotifyError("user", $"Username is incorrect."); return(ResponseBadRequest()); } var result = await _accessManager.ConfirmEmailToken(user, confirmEmail.Code); if (result.Succeeded) { return(Response($"Email successfully confirmed")); } await AddIdentityErrors(result); return(ResponseBadRequest()); }