23 lines
782 B
Plaintext
Raw Normal View History

2025-05-01 01:19:53 -03:00
@using System.Security.Claims
<AuthorizeView>
<Authorized Context="authContext">
<div class="d-flex justify-content-end align-items-center gap-3 px-3 py-2">
<span class="fw-bold text-dark">
Bienvenido, @GetUserDisplayName(authContext.User)
</span>
<a href="Logout" class="btn btn-sm btn-danger rounded-3 d-flex align-items-center gap-1 text-decoration-none">
<i class="oi oi-account-logout"></i>
<span>Cerrar sesión</span>
</a>
</div>
</Authorized>
</AuthorizeView>
@code {
private string GetUserDisplayName(ClaimsPrincipal user)
{
return user.FindFirst("fullName")?.Value
?? user.Identity?.Name
?? "Usuario";
}
}