Open Closed

Overriding the logout menu gives the error #5101


User avatar
0
hardip created
  • ABP Framework version: v7.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

When logging out from the server side pages (Manage your profile page), the redirected url goes to swagger.

refer

I wanted to override this behavior, I followed the abp.io documentation : https://docs.abp.io/en/abp/latest/UI/Blazor/Navigation-Menu#manipulating-the-existing-menu-items

but when I call the context.Menu.FindMenuItem("Account.Logout"), it returns null object.

refer

Any solution?


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

    hi

    You can override the Volo.Abp.Account.Public.Web.Pages.Account.LogoutModel

  • User Avatar
    0
    hardip created

    Overridding the LoginModel does not work

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What do you mean does not work?

    Is your class executed?

  • User Avatar
    0
    hardip created

    When changing the LogoutModal to SBCLogoutModal(New) in Login.cshtml gives the error

    html refer :

    error refer :

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try to add typeof(SBCLogoutModal) to ExposeServices.

  • User Avatar
    0
    hardip created

    Yes, that is corrected but it goes to the swagger still.

    What is the difference between LogoutModal and LoggedoutModal?

    because there is also overridden logged out modal as well

    refer :

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    If you are using OpenIddict you can try to override the LogoutController

    [HttpGet]
    public virtual async Task<IActionResult> GetAsync()
    {
        // Ask ASP.NET Core Identity to delete the local and external cookies created
        // when the user agent is redirected from the external identity provider
        // after a successful authentication flow (e.g Google or Facebook).
        await SignInManager.SignOutAsync();
        
        // Returning a SignOutResult will ask OpenIddict to redirect the user agent
        // to the post_logout_redirect_uri specified by the client application or to
        // the RedirectUri specified in the authentication properties if none was set.
        return SignOut(
            authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,
            properties: new AuthenticationProperties {RedirectUri = "/your_custom_url"});
    }
    

    https://github.com/abpframework/abp/blob/dev/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/LogoutController.cs

  • User Avatar
    0
    hardip created

    Resolved by

    Updated "RedirectToPage" to "Redirect" in loginmodel (extendend)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11