public async Task <IActionResult> ChangeEmailCallback(long userId, string email, string token, string returnUrl) { var member = await _userService.FindByIdAsync(userId); if (member != null && !string.IsNullOrWhiteSpace(email) && !string.IsNullOrWhiteSpace(token)) { var result = await _userService.ChangeEmailAsync(member, email, token); if (result.Succeeded) { TempData.AddAlert(AlertMode.Alert, AlertType.Success, $"You are now logged in with the email {email}." + $" You will use this email to sign into your account in the future."); await _signInService.RefreshSignInAsync(member); } else { TempData.AddAlert(AlertMode.Alert, AlertType.Error, result.Errors.Humanize()); } } else { TempData.AddAlert(AlertMode.Alert, AlertType.Error, "Error changing email."); } return(LocalRedirect(returnUrl ?? Url.Content("~/"))); }