Browse Source

create ChangePasswordInput

pull/1584/head
Yunus Emre Kalkan 7 years ago
parent
commit
b2cd38e49e
  1. 13
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ChangePasswordInput.cs
  2. 2
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs
  3. 4
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs
  4. 4
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs

13
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ChangePasswordInput.cs

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volo.Abp.Identity
{
public class ChangePasswordInput
{
public string CurrentPassword { get; set; }
public string NewPassword { get; set; }
}
}

2
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs

@ -9,6 +9,6 @@ namespace Volo.Abp.Identity
Task<ProfileDto> UpdateAsync(UpdateProfileDto input);
Task ChangePasswordAsync(string currentPassword, string newPassword);
Task ChangePasswordAsync(ChangePasswordInput input);
}
}

4
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs

@ -50,10 +50,10 @@ namespace Volo.Abp.Identity
return ObjectMapper.Map<IdentityUser, ProfileDto>(user);
}
public async Task ChangePasswordAsync(string currentPassword, string newPassword)
public async Task ChangePasswordAsync(ChangePasswordInput input)
{
var currentUser = await _userManager.GetByIdAsync(CurrentUser.GetId());
(await _userManager.ChangePasswordAsync(currentUser, currentPassword, newPassword)).CheckErrors();
(await _userManager.ChangePasswordAsync(currentUser, input.CurrentPassword, input.NewPassword)).CheckErrors();
}
}
}

4
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs

@ -31,9 +31,9 @@ namespace Volo.Abp.Identity
[HttpPost]
[Route("change-password")]
public Task ChangePasswordAsync(string currentPassword, string newPassword)
public Task ChangePasswordAsync(ChangePasswordInput input)
{
return _profileAppService.ChangePasswordAsync(currentPassword, newPassword);
return _profileAppService.ChangePasswordAsync(input);
}
}
}

Loading…
Cancel
Save