Browse Source

Merge pull request #390 from colinin/4.4.2

feat(profile): added an interface for two factor
pull/396/head
yx lin 4 years ago
committed by GitHub
parent
commit
c78bce0e6c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/TwoFactorEnabledDto.cs
  2. 2
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs
  3. 7
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IMyProfileAppService.cs
  4. 2
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityUserAppService.cs
  5. 13
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/MyProfileAppService.cs
  6. 2
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IdentityUserController.cs
  7. 8
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/MyProfileController.cs

14
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/ChangeTwoFactorEnabledDto.cs → aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/TwoFactorEnabledDto.cs

@ -1,7 +1,7 @@
namespace LINGYUN.Abp.Identity
{
public class ChangeTwoFactorEnabledDto
{
public bool Enabled { get; set; }
}
}
namespace LINGYUN.Abp.Identity
{
public class TwoFactorEnabledDto
{
public bool Enabled { get; set; }
}
}

2
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs

@ -37,7 +37,7 @@ namespace LINGYUN.Abp.Identity
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
Task ChangeTwoFactorEnabledAsync(Guid id, ChangeTwoFactorEnabledDto input);
Task ChangeTwoFactorEnabledAsync(Guid id, TwoFactorEnabledDto input);
/// <summary>
/// 变更用户密码
/// </summary>

7
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IMyProfileAppService.cs

@ -12,11 +12,16 @@ namespace LINGYUN.Abp.Identity
/// <returns></returns>
Task SetClaimAsync(IdentityUserClaimSetDto input);
/// <summary>
/// 获取二次认证状态
/// </summary>
/// <returns></returns>
Task<TwoFactorEnabledDto> GetTwoFactorEnabledAsync();
/// <summary>
/// 改变二次认证
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task ChangeTwoFactorEnabledAsync(ChangeTwoFactorEnabledDto input);
Task ChangeTwoFactorEnabledAsync(TwoFactorEnabledDto input);
/// <summary>
/// 发送改变手机号验证码
/// </summary>

2
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityUserAppService.cs

@ -138,7 +138,7 @@ namespace LINGYUN.Abp.Identity
}
[Authorize(Volo.Abp.Identity.IdentityPermissions.Users.Update)]
public virtual async Task ChangeTwoFactorEnabledAsync(Guid id, ChangeTwoFactorEnabledDto input)
public virtual async Task ChangeTwoFactorEnabledAsync(Guid id, TwoFactorEnabledDto input)
{
var user = await GetUserAsync(id);

13
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/MyProfileAppService.cs

@ -59,7 +59,18 @@ namespace LINGYUN.Abp.Identity
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task ChangeTwoFactorEnabledAsync(ChangeTwoFactorEnabledDto input)
public virtual async Task<TwoFactorEnabledDto> GetTwoFactorEnabledAsync()
{
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
return new TwoFactorEnabledDto
{
Enabled = await UserManager.GetTwoFactorEnabledAsync(user),
};
}
public virtual async Task ChangeTwoFactorEnabledAsync(TwoFactorEnabledDto input)
{
// Removed See: https://github.com/abpframework/abp/pull/7719
//if (!await SettingProvider.IsTrueAsync(IdentitySettingNames.TwoFactor.UsersCanChange))

2
aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IdentityUserController.cs

@ -87,7 +87,7 @@ namespace LINGYUN.Abp.Identity
[HttpPut]
[Route("change-two-factor")]
public virtual async Task ChangeTwoFactorEnabledAsync(Guid id, ChangeTwoFactorEnabledDto input)
public virtual async Task ChangeTwoFactorEnabledAsync(Guid id, TwoFactorEnabledDto input)
{
await UserAppService.ChangeTwoFactorEnabledAsync(id, input);
}

8
aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/MyProfileController.cs

@ -27,10 +27,16 @@ namespace LINGYUN.Abp.Identity
await MyProfileAppService.SetClaimAsync(input);
}
[HttpGet]
[Route("two-factor")]
public virtual async Task<TwoFactorEnabledDto> GetTwoFactorEnabledAsync()
{
return await MyProfileAppService.GetTwoFactorEnabledAsync();
}
[HttpPut]
[Route("change-two-factor")]
public virtual async Task ChangeTwoFactorEnabledAsync(ChangeTwoFactorEnabledDto input)
public virtual async Task ChangeTwoFactorEnabledAsync(TwoFactorEnabledDto input)
{
await MyProfileAppService.ChangeTwoFactorEnabledAsync(input);
}

Loading…
Cancel
Save