From 2f80b3a980647672300f2b42ec5d1b7dea26a0ee Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 17 Apr 2024 20:55:27 +0800 Subject: [PATCH] Add AbpAuthenticationSessionStateViewComponent to logout from other tabs for MVC UI --- .../AbpAspNetCoreMvcUiThemeSharedModule.cs | 8 +++ ...AuthenticationSessionStateViewComponent.cs | 11 ++++ .../Default.cshtml | 61 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/AbpAuthenticationSessionStateViewComponent.cs create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/Default.cshtml diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs index 109746e34f..c9069bd5e3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/AbpAspNetCoreMvcUiThemeSharedModule.cs @@ -3,8 +3,11 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Packages; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpAuthenticationSessionState; +using Volo.Abp.AspNetCore.Mvc.UI.Theming; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; using Volo.Abp.Modularity; +using Volo.Abp.Ui.LayoutHooks; using Volo.Abp.VirtualFileSystem; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; @@ -30,6 +33,11 @@ public class AbpAspNetCoreMvcUiThemeSharedModule : AbpModule { options.FileSets.AddEmbedded("Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared"); }); + + Configure(options => + { + options.Add(LayoutHooks.Body.Last, typeof(AbpAuthenticationSessionStateViewComponent)); + }); Configure(options => { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/AbpAuthenticationSessionStateViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/AbpAuthenticationSessionStateViewComponent.cs new file mode 100644 index 0000000000..ceb9a32b91 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/AbpAuthenticationSessionStateViewComponent.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpAuthenticationSessionState; + +public class AbpAuthenticationSessionStateViewComponent : AbpViewComponent +{ +public virtual IViewComponentResult Invoke() +{ + return View("~/Pages/Shared/Components/AbpAuthenticationSessionState/Default.cshtml"); +} +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/Default.cshtml new file mode 100644 index 0000000000..8c07e6fccf --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Pages/Shared/Components/AbpAuthenticationSessionState/Default.cshtml @@ -0,0 +1,61 @@ + \ No newline at end of file