Browse Source

fix: 用户修改密码多语言提示异常

pull/89/head
王军 4 years ago
parent
commit
d2e0d76479
  1. 14
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs

14
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs

@ -1,9 +1,11 @@
using Lion.AbpPro.BasicManagement.Localization;
using Lion.AbpPro.BasicManagement.Users.Dtos; using Lion.AbpPro.BasicManagement.Users.Dtos;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Magicodes.ExporterAndImporter.Excel.AspNetCore; using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Account; using Volo.Abp.Account;
using Volo.Abp.Identity.Localization;
namespace Lion.AbpPro.BasicManagement.Users namespace Lion.AbpPro.BasicManagement.Users
{ {
@ -15,18 +17,22 @@ namespace Lion.AbpPro.BasicManagement.Users
private readonly IIdentityUserRepository _identityUserRepository; private readonly IIdentityUserRepository _identityUserRepository;
private readonly IExcelExporter _excelExporter; private readonly IExcelExporter _excelExporter;
private readonly IOptions<IdentityOptions> _options; private readonly IOptions<IdentityOptions> _options;
private readonly IStringLocalizer<IdentityResource> _localizer;
public UserAppService( public UserAppService(
IIdentityUserAppService identityUserAppService, IIdentityUserAppService identityUserAppService,
IdentityUserManager userManager, IdentityUserManager userManager,
IIdentityUserRepository userRepository, IIdentityUserRepository userRepository,
IExcelExporter excelExporter, IExcelExporter excelExporter,
IOptions<IdentityOptions> options) IOptions<IdentityOptions> options,
IStringLocalizer<IdentityResource> localizer)
{ {
_identityUserAppService = identityUserAppService; _identityUserAppService = identityUserAppService;
_userManager = userManager; _userManager = userManager;
_identityUserRepository = userRepository; _identityUserRepository = userRepository;
_excelExporter = excelExporter; _excelExporter = excelExporter;
_options = options; _options = options;
_localizer = localizer;
} }
/// <summary> /// <summary>
@ -117,8 +123,6 @@ namespace Lion.AbpPro.BasicManagement.Users
/// <summary> /// <summary>
/// 修改密码 /// 修改密码
/// </summary> /// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<bool> ChangePasswordAsync(ChangePasswordInput input) public async Task<bool> ChangePasswordAsync(ChangePasswordInput input)
{ {
await _options.SetAsync(); await _options.SetAsync();
@ -134,7 +138,7 @@ namespace Lion.AbpPro.BasicManagement.Users
} }
return !result.Succeeded return !result.Succeeded
? throw new UserFriendlyException(result?.Errors?.FirstOrDefault()?.Description) ? throw new BusinessException("Volo.Abp.Identity:" + result?.Errors?.FirstOrDefault()?.Code)
: result.Succeeded; : result.Succeeded;
} }
@ -151,4 +155,4 @@ namespace Lion.AbpPro.BasicManagement.Users
await _userManager.UpdateAsync(identityUser); await _userManager.UpdateAsync(identityUser);
} }
} }
} }
Loading…
Cancel
Save