diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs index a599207f23..4c1c90d4cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs @@ -1,9 +1,13 @@ -using Volo.Abp.Domain.Entities; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity { public class IdentityUserUpdateDto : IdentityUserCreateOrUpdateDtoBase, IHasConcurrencyStamp { + [StringLength(IdentityUserConsts.MaxPasswordLength)] + public string Password { get; set; } + public string ConcurrencyStamp { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index ad87b0041f..92717ec060 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -72,6 +72,13 @@ namespace Volo.Abp.Identity (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); await UpdateUserByInput(user, input); (await _userManager.UpdateAsync(user)).CheckErrors(); + + if (!input.Password.IsNullOrEmpty()) + { + (await _userManager.RemovePasswordAsync(user)).CheckErrors(); + (await _userManager.AddPasswordAsync(user, input.Password)).CheckErrors(); + } + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(user); diff --git a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs index c8651d8e88..7419a6f668 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Volo.Abp.AutoMapper; using Volo.Abp.Identity.Web.Pages.Identity.Roles; using CreateUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel; using EditUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel; @@ -16,7 +17,8 @@ namespace Volo.Abp.Identity.Web private void CreateUserMappings() { //List - CreateMap(); + CreateMap() + .Ignore(x => x.Password); //CreateModal CreateMap() diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml index 247e59e46b..26962350e0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml @@ -19,6 +19,7 @@ + diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index 771b4fbcd9..364a1b4049 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -72,6 +72,10 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users [StringLength(IdentityUserConsts.MaxSurnameLength)] public string Surname { get; set; } + [StringLength(IdentityUserConsts.MaxPasswordLength)] + [DataType(DataType.Password)] + public string Password { get; set; } + [Required] [EmailAddress] [StringLength(IdentityUserConsts.MaxEmailLength)] diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs index c418c261ff..6fbf23ed73 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs @@ -100,6 +100,7 @@ namespace Volo.Abp.Identity LockoutEnabled = true, TwoFactorEnabled = true, PhoneNumber = CreateRandomPhoneNumber(), + Password = "123qwe4R*", Email = CreateRandomEmail(), RoleNames = new[] { "admin", "moderator" }, ConcurrencyStamp = johnNash.ConcurrencyStamp, diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index 4771b2d949..7778ca8885 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -137,9 +137,9 @@ -
+
* + > *