All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (pull_request) Successful in 36m19s
close #78
29 lines
1011 B
Plaintext
29 lines
1011 B
Plaintext
@using System.Security.Claims
|
|
<AuthorizeView>
|
|
<Authorized Context="authContext">
|
|
<div class="login-state">
|
|
<span class="user-avatar" aria-hidden="true">@GetInitial(authContext.User)</span>
|
|
<span class="user-copy">
|
|
<small>Sesión activa</small>
|
|
<strong>@GetUserDisplayName(authContext.User)</strong>
|
|
</span>
|
|
<a href="Logout" class="logout-button" title="Cerrar sesión" aria-label="Cerrar sesión">
|
|
<i class="oi oi-account-logout"></i>
|
|
</a>
|
|
</div>
|
|
</Authorized>
|
|
</AuthorizeView>
|
|
@code {
|
|
private string GetUserDisplayName(ClaimsPrincipal user)
|
|
{
|
|
return user.FindFirst("fullName")?.Value
|
|
?? user.Identity?.Name
|
|
?? "Usuario";
|
|
}
|
|
private string GetInitial(ClaimsPrincipal user)
|
|
{
|
|
var displayName = GetUserDisplayName(user).Trim();
|
|
return displayName.Length > 0 ? displayName[..1].ToUpperInvariant() : "U";
|
|
}
|
|
}
|