CodeLiturgy.Dashboard/CodeLiturgy.Views/Controllers/HomeController.cs

43 lines
953 B
C#
Raw Normal View History

2022-11-18 03:15:53 +03:00
using CodeLiturgy.Data.Auth.Context.Users;
2022-10-27 20:13:02 +03:00
using Microsoft.AspNetCore.Mvc;
2022-10-30 19:48:24 +03:00
using CodeLiturgy.Views.Utils;
2022-10-27 20:13:02 +03:00
using Duende.IdentityServer.Extensions;
using Microsoft.AspNetCore.Authorization;
2022-10-30 19:48:24 +03:00
namespace CodeLiturgy.Views.Controllers;
2022-09-19 05:50:15 +03:00
2022-09-26 04:05:23 +03:00
[System.Web.Mvc.Route("/")]
2022-10-27 20:13:02 +03:00
[System.Web.Mvc.Authorize]
public class HomeController : LoggedInUserController
2022-09-19 05:50:15 +03:00
{
2022-11-22 18:05:35 +03:00
public HomeController(
ApplicationUserManager userManager,
ILogger<HomeController> logger) : base(userManager, logger)
2022-09-19 05:50:15 +03:00
{
2022-10-27 20:13:02 +03:00
_userManager = userManager;
2022-09-19 05:50:15 +03:00
_logger = logger;
}
2022-11-17 00:17:44 +03:00
public override void OnInitialization()
{
var menu = LayoutCache.Root.ChildrenToUrl();
SetHeaderMenu(menu);
}
2022-10-27 20:13:02 +03:00
[AllowAnonymous]
public async Task<IActionResult> Index()
2022-09-19 05:50:15 +03:00
{
2022-10-27 20:13:02 +03:00
await OnEveryAction();
if (!User.IsAuthenticated())
{
return Redirect("/auth/login");
}
2022-09-19 05:50:15 +03:00
return View();
}
2022-10-27 20:13:02 +03:00
2022-09-19 05:50:15 +03:00
}