Refactor pull/4975

pull/4975/head
Yunus Emre Kalkan 5 years ago
parent 8c3b9b9fc9
commit 36fa40e61e

@ -29,7 +29,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user);
DisablePasswordChange = user.IsExternalLoggedIn;
DisablePasswordChange = user.IsExternal;
HideOldPasswordInput = !user.HasPassword;
return Page();

@ -14,7 +14,7 @@ namespace Volo.Abp.Identity
public string PhoneNumber { get; set; }
public bool IsExternalLoggedIn { get; set; }
public bool IsExternal { get; set; }
public bool HasPassword { get; set; }
}

@ -14,8 +14,8 @@ namespace Volo.Abp.Identity
.MapExtraProperties();
CreateMap<IdentityUser, ProfileDto>()
.Ignore(x=>x.IsExternalLoggedIn)
.Ignore(x=>x.HasPassword)
.ForMember(dest => dest.HasPassword,
op => op.MapFrom(src => src.PasswordHash != null))
.MapExtraProperties();
}
}

@ -23,11 +23,7 @@ namespace Volo.Abp.Identity
{
var currentUser = await UserManager.GetByIdAsync(CurrentUser.GetId());
var profile = ObjectMapper.Map<IdentityUser, ProfileDto>(currentUser);
profile.IsExternalLoggedIn = currentUser.IsExternal;
profile.HasPassword = currentUser.PasswordHash != null;
return profile;
return ObjectMapper.Map<IdentityUser, ProfileDto>(currentUser);
}
public virtual async Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
@ -69,7 +65,6 @@ namespace Volo.Abp.Identity
if (currentUser.PasswordHash == null)
{
(await UserManager.RemovePasswordAsync(currentUser)).CheckErrors();
(await UserManager.AddPasswordAsync(currentUser, input.NewPassword)).CheckErrors();
return;

Loading…
Cancel
Save