mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added user image and navbar elements
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using System.Security.Claims
|
||||
@inject IViewLocalizer T
|
||||
@{
|
||||
bool IsAuthenticated = User.Identity?.IsAuthenticated ?? false;
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -42,7 +45,7 @@
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
@if (User.Identity?.IsAuthenticated ?? false)
|
||||
@if (IsAuthenticated)
|
||||
{
|
||||
@if (User.HasClaim(ClaimTypes.Role, "CanInventorize"))
|
||||
{
|
||||
@@ -75,17 +78,32 @@
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li class="nav-item">
|
||||
@if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
<a class="nav-link text" asp-area="" asp-controller="Home" asp-action="Logout">@T["Log out"]</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!IsAuthenticated)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text" asp-area="" asp-controller="Home" asp-action="Login">@T["Login"]</a>
|
||||
}
|
||||
</li>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@if (IsAuthenticated && User.Identity is not null)
|
||||
{
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<div class="nav-link dropdown-toggle d-flex align-items-center" href="#" id="userDropdown" role="button"
|
||||
data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<img src="/Home/UserPhoto?uid=@User.Identity.Name&size=256" alt="Profile"
|
||||
class="rounded-circle me-2" width="30" height="30" />
|
||||
<span>@User.Identity.Name</span>
|
||||
</div>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
|
||||
<li><a class="dropdown-item" asp-controller="Settings" asp-action="User">@T["User settings"]</a></li>
|
||||
<li><a class="dropdown-item" asp-controller="Settings" asp-action="Admin">@T["Admin settings"]</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-action="Logout">@T["Log out"]</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user