Starts in:
0 DAY
14 HRS
13 MIN
38 SEC
Starts in:
0 D
14 H
13 M
38 S
Open Closed

Remove two auth and Profile picture tab from manage profile page #2926


User avatar
0
safi created

Hi

I want to remove two auth and picture tabs from the manage profile page so how can I delete or hide please let me know.

  • ABP Framework version: v4.4.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Thanks,


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add an IProfileManagementPageContributor service and remove the PageGroup from the context.

  • User Avatar
    0
    safi created

    IProfileManagementPageContributor

    do I need to use this code?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    No. This is build-in code, You need to remove the item from the context.

  • User Avatar
    0
    safi created

    IProfileManagementPageContributor

    do I need to use this code?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You add a MyProfileManagementPageContributorservice and remove two auth and pictures from the context.

  • User Avatar
    0
    safi created

    You add a MyProfileManagementPageContributorservice and remove two auth and pictures from the context.

    public class MyAccountProfileManagementPageContributor : IProfileManagementPageContributor { public async Task ConfigureAsync(ProfileManagementPageCreationContext context) { var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AccountResource>>();

            if (await IsPasswordChangeEnabled(context))
            {
                context.Groups.Add(
                    new ProfileManagementPageGroup(
                        "Volo-Abp-Account-Password",
                        l["ProfileTab:Password"],
                        typeof(AccountProfilePasswordManagementGroupViewComponent)
                    )
                );
            }
    
            context.Groups.Add(
                new ProfileManagementPageGroup(
                    "Volo-Abp-Account-PersonalInfo",
                    l["ProfileTab:PersonalInfo"],
                    typeof(AccountProfilePersonalInfoManagementGroupViewComponent)
                )
            );
        }
    
        protected virtual async Task&lt;bool&gt; IsPasswordChangeEnabled(ProfileManagementPageCreationContext context)
        {
            var userManager = context.ServiceProvider.GetRequiredService&lt;IdentityUserManager&gt;();
            var currentUser = context.ServiceProvider.GetRequiredService&lt;ICurrentUser&gt;();
    
            var user = await userManager.GetByIdAsync(currentUser.GetId());
    
            return !user.IsExternal;
        }
    }
    

    do I need to call this anywhere?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer
    Configure<ProfileManagementPageOptions>(options =>
    {
        options.Contributors.Add(new MyAccountProfileManagementPageContributor());
    });
    
    
    
    public async Task ConfigureAsync(ProfileManagementPageCreationContext context)
    {
        context.Groups.Remove..
    
    }
    
  • User Avatar
    0
    safi created

    ProfileManagementPageCreationContext

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    context.Groups.RemoveAll(x => x.Id == "Volo-Abp-Account-Picture" || x.Id == "Volo-Abp-Account-TwoFactor");

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06