public ActionResult SetTwoFactor(UpdateTwoFactorVerificationViewModel twoFactorVerificationViewModel) { ViewData[AccountConstants.SuccessTwoFactorUpdate] = false; if (ModelState.IsValid) { try { var contract = new UpdateTwoFactorContract { TwoFactorIsEnabled = twoFactorVerificationViewModel.TwoFactorEnabled }; var client = GetUserClient(); client.SetTwoFactor(contract); ViewData[AccountConstants.SuccessTwoFactorUpdate] = true; } catch (HttpErrorCodeException e) { AddErrors(e); } catch (MainServiceException e) { AddErrors(e); } } twoFactorVerificationViewModel = CreateUpdateTwoFactorVerificationViewModel(); return(PartialView("UserProfile/_UpdateTwoFactorVerification", twoFactorVerificationViewModel)); }
public void SetTwoFactor(int userId, UpdateTwoFactorContract data) { var contract = new AuthChangeTwoFactorContract { TwoFactorIsEnabled = data.TwoFactorIsEnabled, }; var client = m_communicationProvider.GetAuthUserApiClient(); client.SetTwoFactorAsync(GetUserExternalId(userId), contract).GetAwaiter().GetResult(); }
public IActionResult TwoFactor([FromBody] UpdateTwoFactorContract data) { try { var userId = m_authenticationManager.GetCurrentUserId(); m_userManager.SetTwoFactor(userId, data); return(Ok()); } catch (HttpErrorCodeException exception) { return(StatusCode(exception.StatusCode, exception.Message)); } }
public void SetTwoFactor(UpdateTwoFactorContract data) { try { m_client.Put <object>($"user/current/two-factor", data); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }