Open Closed

How to disable some features of the Account Module??? #3033


User avatar
0
diennttlu@gmail.com created

I'm using the Commercial version. I want to disable some features: Account Linking, Two Factor Authentication, User Profile Picture. Help me!!

  • ABP Framework version: v4.4.1
  • UI type: MVC
  • DB provider: EF Core

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Account Linking and User Profile Picture

    public class MyMenuContributor : IMenuContributor
    {
        public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name == StandardMenus.Main)
            {
                context.Menu.TryRemoveMenuItem("Account.LinkedAccounts");
                context.Menu.TryRemoveMenuItem("Account.Manage");
            }
        }
    }
    

    Two Factor Authentication

    public class MyFeatureDefinitionProvider : FeatureDefinitionProvider
    {
        public override void Define(IFeatureDefinitionContext context)
        {
            var group = context.GetGroupOrNull(IdentityProFeature.GroupName);
    
            var twoFeature = group.Features.First(x => x.Name == IdentityProFeature.TwoFactor);
            twoFeature.DefaultValue = "false";
            twoFeature.IsAvailableToHost = false;
            twoFeature.IsVisibleToClients = false;
        }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11