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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
35 additions and
13 deletions
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/TwoFactorEnabledDto.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IIdentityUserAppService.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IMyProfileAppService.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityUserAppService.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/MyProfileAppService.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IdentityUserController.cs
-
aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/MyProfileController.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; } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -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>
|
|
|
|
|
|
|
|
@ -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>
|
|
|
|
|
|
|
|
@ -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); |
|
|
|
|
|
|
|
|
|
|
|
@ -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))
|
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|