public async Task <IActionResult> DisableTwoFactorAuthenticationPost() { Result result = await _twoFactorAuthService.Disable(GetUserId()); if (result.Failure) { SaveTempData(INDEX_STATUS_ALERT_TEMP_DATA_KEY, StatusAlertViewExtension.Get(result)); } else { SaveTempData(INDEX_STATUS_ALERT_TEMP_DATA_KEY, StatusAlertViewExtension.Get("Two factor authentication disabled.")); } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DisableTwoFactorAuthenticatorPost() { TwoFactorAuthenticatorViewModel viewModel; Result result = await _twoFactorAuthService.Disable(GetUserId()); if (result.Failure) { viewModel = new TwoFactorAuthenticatorViewModel(StatusAlertViewExtension.Get(result)); ModelState.AddErrors(result.Errors); return(View(viewModel)); } TwoFactorAuthenticatorViewModel twoFaViewModel = new TwoFactorAuthenticatorViewModel(StatusAlertViewExtension.Get("Two factor authentication disabled.")); return(View("TwoFactorAuthenticator", twoFaViewModel)); }