Browse Source

Use static helper instead extension method.

pull/5409/head
maliming 5 years ago
parent
commit
daeee64c2d
  1. 4
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Features/IdentityTwoFactorBehaviourFeatureHelper.cs
  2. 6
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json
  3. 7
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentityTwoFactorBehaviourSettingHelper.cs
  4. 13
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityTwoFactorManager.cs
  5. 5
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs

4
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Features/IdentityFeatureCheckerExtensions.cs → modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Features/IdentityTwoFactorBehaviourFeatureHelper.cs

@ -5,9 +5,9 @@ using Volo.Abp.Features;
namespace Volo.Abp.Identity.Features
{
public static class IdentityFeatureCheckerExtensions
public static class IdentityTwoFactorBehaviourFeatureHelper
{
public static async Task<IdentityTwoFactorBehaviour> GetIdentityTwoFactorBehaviour([NotNull] this IFeatureChecker featureChecker)
public static async Task<IdentityTwoFactorBehaviour> Get([NotNull] IFeatureChecker featureChecker)
{
Check.NotNull(featureChecker, nameof(featureChecker));

6
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json

@ -81,7 +81,7 @@
"Feature:TwoFactorDescription": "İki faktörlü kimlik doğrulama",
"Feature:TwoFactor.Optional": "İsteğe bağlı",
"Feature:TwoFactor.Disabled": "Devre dışı",
"Feature:TwoFactor.Forced": "Zorla etkinleştirildi",
"Feature:TwoFactor.Forced": "Zorunlu",
"DisplayName:Abp.Identity.Password.RequiredLength": "Uzunluk gerekli",
"DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Tekil karakter gerekli",
"DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Alfasayısal olmayan karakter gerekli",
@ -112,7 +112,7 @@
"Description:Abp.Identity.User.IsEmailUpdateEnabled": "E-posta alanının, kullanıcının kendisi tarafından güncellenebilirliği",
"DisplayName:Abp.Identity.TwoFactorBehaviour": "İki faktörlü kimlik doğrulama davranışı",
"Description:Abp.Identity.TwoFactorBehaviour": "İki faktörlü kimlik doğrulama davranışı",
"DisplayName:Abp.Identity.UsersCanChange": "Kullanıcıların faktör kimlik doğrulamasını değiştirmesine izin verin.",
"Description:Abp.Identity.UsersCanChange": "Kullanıcıların faktör kimlik doğrulamasını değiştirmesine izin verin."
"DisplayName:Abp.Identity.UsersCanChange": "Kullanıcıların iki faktörlü kimlik doğrulama davranışını değiştirmelerine izin verin.",
"Description:Abp.Identity.UsersCanChange": "Kullanıcıların iki faktörlü kimlik doğrulama davranışını değiştirmelerine izin verin"
}
}

7
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySettingProviderExtensions.cs → modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentityTwoFactorBehaviourSettingHelper.cs

@ -2,14 +2,13 @@
using System.Threading.Tasks;
using JetBrains.Annotations;
using Volo.Abp.Identity.Features;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings;
namespace Volo.Abp.Identity
namespace Volo.Abp.Identity.Settings
{
public static class IdentitySettingProviderExtensions
public static class IdentityTwoFactorBehaviourSettingHelper
{
public static async Task<IdentityTwoFactorBehaviour> GetIdentityTwoFactorBehaviour([NotNull] this ISettingProvider settingProvider)
public static async Task<IdentityTwoFactorBehaviour> Get([NotNull] ISettingProvider settingProvider)
{
Check.NotNull(settingProvider, nameof(settingProvider));

13
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityTwoFactorManager.cs

@ -2,6 +2,7 @@ using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
using Volo.Abp.Features;
using Volo.Abp.Identity.Features;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings;
namespace Volo.Abp.Identity
@ -20,10 +21,10 @@ namespace Volo.Abp.Identity
public virtual async Task<bool> IsOptionalAsync()
{
var feature = await FeatureChecker.GetIdentityTwoFactorBehaviour();
var feature = await IdentityTwoFactorBehaviourFeatureHelper.Get(FeatureChecker);
if (feature == IdentityTwoFactorBehaviour.Optional)
{
var setting = await SettingProvider.GetIdentityTwoFactorBehaviour();
var setting = await IdentityTwoFactorBehaviourSettingHelper.Get(SettingProvider);
if (setting == IdentityTwoFactorBehaviour.Optional)
{
return true;
@ -35,13 +36,13 @@ namespace Volo.Abp.Identity
public virtual async Task<bool> IsForcedEnableAsync()
{
var feature = await FeatureChecker.GetIdentityTwoFactorBehaviour();
var feature = await IdentityTwoFactorBehaviourFeatureHelper.Get(FeatureChecker);
if (feature == IdentityTwoFactorBehaviour.Forced)
{
return true;
}
var setting = await SettingProvider.GetIdentityTwoFactorBehaviour();
var setting = await IdentityTwoFactorBehaviourSettingHelper.Get(SettingProvider);
if (setting == IdentityTwoFactorBehaviour.Forced)
{
return true;
@ -52,13 +53,13 @@ namespace Volo.Abp.Identity
public virtual async Task<bool> IsForcedDisableAsync()
{
var feature = await FeatureChecker.GetIdentityTwoFactorBehaviour();
var feature = await IdentityTwoFactorBehaviourFeatureHelper.Get(FeatureChecker);
if (feature == IdentityTwoFactorBehaviour.Disabled)
{
return true;
}
var setting = await SettingProvider.GetIdentityTwoFactorBehaviour();
var setting = await IdentityTwoFactorBehaviourSettingHelper.Get(SettingProvider);
if (setting == IdentityTwoFactorBehaviour.Disabled)
{
return true;

5
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs

@ -14,6 +14,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Features;
using Volo.Abp.Guids;
using Volo.Abp.Identity.Features;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings;
namespace Volo.Abp.Identity
@ -947,7 +948,7 @@ namespace Volo.Abp.Identity
Check.NotNull(user, nameof(user));
var feature = await FeatureChecker.GetIdentityTwoFactorBehaviour();
var feature = await IdentityTwoFactorBehaviourFeatureHelper.Get(FeatureChecker);
if (feature == IdentityTwoFactorBehaviour.Disabled)
{
return false;
@ -957,7 +958,7 @@ namespace Volo.Abp.Identity
return true;
}
var setting = await SettingProvider.GetIdentityTwoFactorBehaviour();
var setting = await IdentityTwoFactorBehaviourSettingHelper.Get(SettingProvider);
if (setting == IdentityTwoFactorBehaviour.Disabled)
{
return false;

Loading…
Cancel
Save