public IActionResult UpdatePassword(UpdatePasswordViewModel model) { ViewData[AccountConstants.SuccessPasswordUpdate] = false; if (ModelState.IsValid) { try { var updateUserPasswordContract = new UpdateUserPasswordContract { NewPassword = model.Password, OldPassword = model.OldPassword }; var client = GetUserClient(); client.UpdateCurrentPassword(updateUserPasswordContract); ViewData[AccountConstants.SuccessPasswordUpdate] = true; return(PartialView("UserProfile/_UpdatePassword", null)); } catch (HttpErrorCodeException e) { AddErrors(e); } catch (MainServiceException e) { AddErrors(e); } } return(PartialView("UserProfile/_UpdatePassword", model)); }
public IActionResult UpdateCurrentPassword([FromBody] UpdateUserPasswordContract data) { try { var userId = m_authenticationManager.GetCurrentUserId(); m_userManager.UpdateUserPassword(userId, data); return(Ok()); } catch (HttpErrorCodeException exception) { return(StatusCode(exception.StatusCode, exception.Message)); } }
public void UpdateUserPassword(int userId, UpdateUserPasswordContract data) { var userExternalId = GetUserExternalId(userId); var contract = new AuthChangePasswordContract { OriginalPassword = data.OldPassword, Password = data.NewPassword }; var client = m_communicationProvider.GetAuthUserApiClient(); client.PasswordChangeAsync(userExternalId, contract).GetAwaiter().GetResult(); }
public void UpdateCurrentPassword(UpdateUserPasswordContract data) { try { //EnsureSecuredClient(); m_client.Put <object>("user/current/password", data); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }