Browse Source

obtain the two factor provider by user id

pull/626/head
cKey 4 years ago
parent
commit
b66cd575e4
  1. 8
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs
  2. 7
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

8
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/GetTwoFactorProvidersInput.cs

@ -1,10 +1,10 @@
using Volo.Abp.Identity; using System;
using Volo.Abp.Validation; using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.Account; namespace LINGYUN.Abp.Account;
public class GetTwoFactorProvidersInput public class GetTwoFactorProvidersInput
{ {
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxUserNameLength))] [Required]
public string UserName { get; set; } public Guid UserId{ get; set; }
} }

7
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<ListResultDto<NameValue>> GetTwoFactorProvidersAsync(GetTwoFactorProvidersInput input) public async virtual Task<ListResultDto<NameValue>> GetTwoFactorProvidersAsync(GetTwoFactorProvidersInput input)
{ {
var user = await UserManager.FindByNameAsync(input.UserName); var user = await UserManager.GetByIdAsync(input.UserId);
if (user == null)
{
throw new UserFriendlyException(L["UserNotRegisterd"]);
}
var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(user); var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(user);
return new ListResultDto<NameValue>( return new ListResultDto<NameValue>(

Loading…
Cancel
Save