diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Home/Index.cs b/src/blazor/admin/BootstrapAdmin.Web/Pages/Home/Index.cs index f6a0352c..6a5bc7e3 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Home/Index.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Home/Index.cs @@ -1,4 +1,6 @@ -namespace BootstrapAdmin.Web.Pages.Home +using Microsoft.AspNetCore.Authorization; + +namespace BootstrapAdmin.Web.Pages.Home { /// /// @@ -6,6 +8,7 @@ [Route("/")] [Route("/Home")] [Route("/Home/Index")] + [Authorize] public class Index : ComponentBase { [Inject] diff --git a/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor b/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor index d5c84ae4..58f57e26 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor @@ -1,40 +1,37 @@ @inherits LayoutComponentBase -@if (Login) -{ - -
- Bootstrap of Blazor - - @DisplayName -
-
- -
- -
- @Title -
+
+ Bootstrap of Blazor + + @DisplayName +
+
+ +
+ +
+ @Title
-
- -
- @DisplayName -
-
+
+
+ +
+ @DisplayName
- -
- @Body -
-
-
@Footer
-
- - - - -} \ No newline at end of file +
+
+ +
+ @Body +
+
+
@Footer
+
+ + + + diff --git a/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor.cs index e00be754..ea4094a1 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Shared/MainLayout.razor.cs @@ -60,13 +60,13 @@ namespace BootstrapAdmin.Web.Shared Context.UserName = userName; Context.DisplayName = DisplayName; - MenuItems = NavigationsService.GetAllMenus("Admin").ToAdminMenus(); + MenuItems = NavigationsService.GetAllMenus(userName).ToAdminMenus(); + + Login = true; } Title = DictsService.GetWebTitle(); Footer = DictsService.GetWebFooter(); - - Login = true; } private Task OnAuthorizing(string url) => SecurityService.AuhorizingNavigation(Context.UserName, url);