41 lines
927 B
C#
41 lines
927 B
C#
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 : UserController
|
|
{
|
|
public HomeController(ApplicationUserManager userManager, ILogger<HomeController> logger) : base(userManager, logger)
|
|
{
|
|
_userManager = userManager;
|
|
_logger = logger;
|
|
}
|
|
|
|
public override void OnInitialization()
|
|
{
|
|
var menu = LayoutCache.Root.ChildrenToUrl();
|
|
SetHeaderMenu(menu);
|
|
}
|
|
|
|
|
|
[AllowAnonymous]
|
|
public async Task<IActionResult> Index()
|
|
{
|
|
await OnEveryAction();
|
|
|
|
if (!User.IsAuthenticated())
|
|
{
|
|
return Redirect("/auth/login");
|
|
}
|
|
|
|
|
|
return View();
|
|
}
|
|
|
|
|
|
|
|
} |