Open Closed

override the login page #8373


User avatar
0
dhaoo created

I want to override the login page, but I don't have the source code for the commercial version. Where can I obtain the commercial version source code? For example, something like this: https://github.com/abpframework/abp/blob/037ef9abe024c03c1f89ab6c933710bcfe3f5c93/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs. Additionally, I want to display tenant information in the user login section. Which page should I override? Something similar to the example shown below.


22 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    Can you please check this document It will help you https://gist.github.com/ebicoglu/ce0f0425bab806d0ee1a87d0073af96b

    Thank you.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I want to override the login page, but I don't have the source code for the commercial version. Where can I obtain the commercial version source code? For example, something like this:

    you can get the source code via CLI abp get-source ...

    Here a CLI command to list all modules

    abp list-modules

    Additionally, I want to display tenant information in the user login section. Which page should I override? Something similar to the example shown below.

    You can add a toolbar to display the current tenant; you don't need to override any page. https://abp.io/docs/latest/framework/ui/mvc-razor-pages/toolbars

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    if you are using ABP studio, it's very easy to override the page.

    you can check the video to know how to do it. https://www.youtube.com/watch?v=uYTbGLtxdUE&t=2394s

  • User Avatar
    0
    dhaoo created

    Hello ,

    Can you please check this document It will help you https://gist.github.com/ebicoglu/ce0f0425bab806d0ee1a87d0073af96b

    Thank you.

    Can I pull the source code of the commercial version?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    https://abp.io/support/questions/8373/Question#answer-3a167ebb-b85e-4819-4443-3b83f23f6526

  • User Avatar
    0
    dhaoo created

    https://abp.io/support/questions/8373/Question#answer-3a167ebb-b85e-4819-4443-3b83f23f6526

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Do you have multiple organizations?

    you can check it here and set the default organization

    https://abp.io/my-organizations

  • User Avatar
    0
    dhaoo created

    I have already downloaded the source code of Account Pro through ABP Suite. Now I want to replace the text box for tenants with a dropdown box. Is there any way to configure it?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi

    you can override the TenantSwitchModal page https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml

  • User Avatar
    0
    dhaoo created

    ok,thanks

  • User Avatar
    0
    dhaoo created

    I cannot find the TenantSwitchModalModel class in the code

  • User Avatar
    0
    dhaoo created

    Hi

    you can override the TenantSwitchModal page https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi

    The namespace is Pages.Abp.MultiTenancy.TenantSwitchModalModel

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs

  • User Avatar
    0
    dhaoo created

    Hi

    The namespace is Pages.Abp.MultiTenancy.TenantSwitchModalModel

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs

    abp can no longer be found under page

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    It works for me.

  • User Avatar
    0
    dhaoo created

    Now I have completed the rewrite, but when I return to the view, I still jump to the view of TenantSwitchModalModel, but I do not jump to the new view. What should I do to overwrite the original view

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Put new TenantSwitchModal.cshtml under the Pages/Abp/MultiTenancy folder https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs

  • User Avatar
    0
    dhaoo created

    I cut the file to the folder as you did and now run an exception: Multiple handlers matched. The following handlers matched route data and had all constraints satisfied. Multiple handlers matched. The following handlers matched route data and had all constraints satisfied

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I can't reproduce it

    @page
    @using Microsoft.AspNetCore.Mvc.Localization
    @using Pages.Abp.MultiTenancy
    @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
    @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
    @using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Localization
    @model AbpSolution2.Web.Pages.Abp.MultiTenancy.MyTenantSwitchModalModel
    @inject IHtmlLocalizer<AbpUiMultiTenancyResource> L
    @{
        Layout = null;
    }
    <abp-dynamic-form abp-model="@Model.Input" asp-page="/Abp/MultiTenancy/TenantSwitchModal">
        <abp-modal>
            <abp-modal-header title="@L["SwitchTenant"].Value"> test</abp-modal-header>
            <abp-modal-body>
                <abp-form-content />
            </abp-modal-body>
            @* TODO: A "Submit" would be better than "Save"! *@
            <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
        </abp-modal>
    </abp-dynamic-form>
    
    
    using System.Threading.Tasks;
    using Microsoft.Extensions.Options;
    using Pages.Abp.MultiTenancy;
    using Volo.Abp.AspNetCore.MultiTenancy;
    using Volo.Abp.DependencyInjection;
    using Volo.Abp.MultiTenancy;
    
    namespace AbpSolution2.Web.Pages.Abp.MultiTenancy;
    
    [Dependency(ReplaceServices = true)]
    public class MyTenantSwitchModalModel : TenantSwitchModalModel
    {
        public MyTenantSwitchModalModel(ITenantStore tenantStore, ITenantNormalizer tenantNormalizer, IOptions<AbpAspNetCoreMultiTenancyOptions> options) : base(tenantStore, tenantNormalizer, options)
        {
        }
        
        public override async Task OnGetAsync()
        {
            Input = new TenantInfoModel();
    
            Input.Name = "test";
            if (CurrentTenant.IsAvailable)
            {
                var tenant = await TenantStore.FindAsync(CurrentTenant.GetId());
                Input.Name = tenant?.Name;
            }
        }
    }
    

  • User Avatar
    0
    dhaoo created

    I see, let's name the new view TenantSwitchModal, thank you! Now I want to display the user tenant information in the red-framed picture after the user logs in. I need to rewrite which pages?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    you don't need to override any page, just need to add a main toolbar. https://abp.io/docs/latest/framework/ui/mvc-razor-pages/toolbars

  • User Avatar
    0
    dhaoo created

    ok,thanks!

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15