Merge pull request #1942 from gdlcf88/reset-password

Update for resetting user password in UserManagement module.
pull/1956/head
Yunus Emre Kalkan 6 years ago committed by GitHub
commit 167d9e5940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -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<IdentityUserDto, EditUserModalModel.UserInfoViewModel>();
CreateMap<IdentityUserDto, EditUserModalModel.UserInfoViewModel>()
.Ignore(x => x.Password);
//CreateModal
CreateMap<CreateUserModalModel.UserInfoViewModel, IdentityUserCreateDto>()

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

@ -137,9 +137,9 @@
<input type="text" id="surname" class="form-control" formControlName="surname" />
</div>
<div *ngIf="!selected.userName" class="form-group">
<div class="form-group">
<label for="password">{{ 'AbpIdentity::Password' | abpLocalization }}</label
><span> * </span>
><span *ngIf="!selected.userName"> * </span>
<input
type="password"
id="password"

@ -94,6 +94,8 @@ export class UsersComponent implements OnInit {
if (!this.selected.userName) {
this.form.addControl('password', new FormControl('', [Validators.required, Validators.maxLength(32)]));
} else {
this.form.addControl('password', new FormControl('', [Validators.maxLength(32)]));
}
});
}

Loading…
Cancel
Save