Browse Source

Merge pull request #626 from colinin/get-two-factor-providers-by-user-id

obtain the two factor provider by user id
pull/645/head
yx lin 4 years ago
committed by GitHub
parent
commit
e1ed19c8d8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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 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; }
}

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)
{
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<NameValue>(

Loading…
Cancel
Save