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

38 lines
880 B
C#

using BlueWest.Data.Auth.Context.Users;
using Microsoft.AspNetCore.Mvc;
using BlueWest.Views.Utils;
using Duende.IdentityServer.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Controller = Microsoft.AspNetCore.Mvc.Controller;
namespace BlueWest.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;
}
[AllowAnonymous]
public async Task<IActionResult> Index()
{
await OnEveryAction();
if (!User.IsAuthenticated())
{
return Redirect("/auth/login");
}
return View();
}
}