add exception filter when user not connected default to needing authentication and apply anonymous to some actions add user in get requests add user relation in link, comment and vote signup and in are ok now!
17 lines
295 B
C#
17 lines
295 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Website.Components
|
|
{
|
|
public sealed class LoginViewComponent : ViewComponent
|
|
{
|
|
public IViewComponentResult Invoke()
|
|
{
|
|
if (User.Identity.IsAuthenticated)
|
|
{
|
|
return View("LoggedIn");
|
|
}
|
|
|
|
return View();
|
|
}
|
|
}
|
|
} |