diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs index 2e65ad104..63e7799b8 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs @@ -1,10 +1,10 @@ -using Volo.Abp.Identity; -using Volo.Abp.Validation; +using System; +using System.ComponentModel.DataAnnotations; namespace LINGYUN.Abp.Account; public class GetTwoFactorProvidersInput { - [DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxUserNameLength))] - public string UserName { get; set; } + [Required] + public Guid UserId{ get; set; } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs index 7767e4421..4b7d0c053 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs @@ -329,12 +329,7 @@ namespace LINGYUN.Abp.Account public async virtual Task> GetTwoFactorProvidersAsync(GetTwoFactorProvidersInput input) { - var user = await UserManager.FindByNameAsync(input.UserName); - - if (user == null) - { - throw new UserFriendlyException(L["UserNotRegisterd"]); - } + var user = await UserManager.GetByIdAsync(input.UserId); var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(user); return new ListResultDto(