Update for resetting user password in UserManagement module.

pull/1942/head
gdlcf88 6 years ago
parent 1f5756edba
commit 95562a4f47

@ -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; }
}
}

@ -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<IdentityUser, IdentityUserDto>(user);

@ -19,6 +19,7 @@
<abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.Surname" />
<abp-input asp-for="UserInfo.Password" />
<abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />

@ -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)]

@ -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,

Loading…
Cancel
Save