using CodeLiturgy.Data.Auth.Context.Users; using Microsoft.AspNetCore.Mvc; using CodeLiturgy.Views.Utils; using Duende.IdentityServer.Extensions; using Microsoft.AspNetCore.Authorization; namespace CodeLiturgy.Views.Controllers; [System.Web.Mvc.Route("/")] [System.Web.Mvc.Authorize] public class HomeController : LoggedInUserController { public HomeController( ApplicationUserManager userManager, ILogger logger) : base(userManager, logger) { _userManager = userManager; _logger = logger; } public override void OnInitialization() { var menu = LayoutCache.Root.ChildrenToUrl(); SetHeaderMenu(menu); } [AllowAnonymous] public async Task Index() { await OnEveryAction(); if (!User.IsAuthenticated()) { return Redirect("/auth/login"); } return View(); } }