public async Task ChangePassword(long accountId, ChangePasswordAccountRequestViewModel changePasswordRequestViewModel) { Account account = await _userManager.FindByIdAsync(accountId.ToString()); IdentityResult result = await _userManager.ChangePasswordAsync(account, changePasswordRequestViewModel.CurrentPassword, changePasswordRequestViewModel.NewPassword); if (!result.Succeeded) { throw new IdentityException(result.Errors.GetErrors()); } }
public async Task <ActionResult> ChangePassword([FromBody] ChangePasswordAccountRequestViewModel changePasswordAccountRequestViewModel) { await _accountsService.ChangePassword(_account.Id, changePasswordAccountRequestViewModel); return(Ok()); }