public async Task <IActionResult> DisableFido2() { var user = await _userManager.GetUserAsync(User); if (user.PasswordHash == null) { return(RedirectToAction("Index", "AccountManage")); } var disableFido2ViewModel = new DisableFido2ViewModel { }; return(View(disableFido2ViewModel)); }
public async Task <IActionResult> DisableFido2(DisableFido2ViewModel disableFido2ViewModel) { if (ModelState.IsValid) { var user = await _userManager.GetUserAsync(User); if (user == null) { return(new NotFoundResult()); } if (disableFido2ViewModel.Confirmation) { _fido2Service.RemoveFido2StoredCredentialsByUserNameAsync(user.UserName); } return(RedirectToAction("Index", "AccountManage")); } ModelState.AddModelError(string.Empty, "invalid operation."); return(View(disableFido2ViewModel)); }