cleaned up Website

This commit is contained in:
t.ruspekhofer 2022-03-01 12:29:30 +01:00
parent 191572b8bf
commit 796f27aff6
3 changed files with 5 additions and 44 deletions

View file

@ -46,7 +46,7 @@
bool isSignedUp = userRole != null;
DateTime flexTime = _raid.FreeForAllDate.Date + _raid.FreeForAllTime.TimeOfDay;
bool isSignUoAllowed = !_raid.IsRandomized && (user.RoleAssignments.FirstOrDefault(a => a.LiebRole.RoleName == _raid.RequiredRole) != null || flexTime < DateTime.Now);
isSignedUp = isSignedUp && user.GuildWars2Accounts.Count > 0 && (_raid.RaidType == RaidType.Planned || user.GuildWars2Accounts.FirstOrDefault()?.EquippedBuilds.Count > 0);
isSignUoAllowed = isSignUoAllowed && user.GuildWars2Accounts.Count > 0 && (_raid.RaidType == RaidType.Planned || user.GuildWars2Accounts.FirstOrDefault()?.EquippedBuilds.Count > 0);
<table class="table">
<tbody>

View file

@ -22,12 +22,12 @@
<InputText @bind-Value="_user.Name" />
</label>
</p>
<p>
@*<p>
<label>
Pronouns:
<InputText @bind-Value="_user.Pronouns" />
</label>
</p>
</p>*@
<p>
<label>
@ -38,7 +38,7 @@
<div class="nav-item px-3">
<NavLink class="nav-link" href="gw2accountedit">
<span class="oi oi-plus" aria-hidden="true"></span> Add Account
<span class="oi oi-plus" aria-hidden="true"></span> Add Guild Wars 2 Account
</NavLink>
</div>

View file

@ -12,10 +12,9 @@
<main>
<div class="top-row px-4">
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
<AuthorizeView>
<Authorized>
<a href="#">Hello, @context.User.Identity.Name!</a>
<a href="accountedit">Hello, @context.User.Identity.Name!</a>
<a href="Account/Logout">Log out</a>
</Authorized>
<NotAuthorized>
@ -27,43 +26,5 @@
<article class="content px-4">
@Body
</article>
<button @onclick="GetClaimsPrincipalData">Get ClaimsPrincipal Data</button>
</main>
</div>
<p>@_authMessage</p>
@if (_claims.Count() > 0)
{
<ul>
@foreach (var claim in _claims)
{
<li>@claim.Type: @claim.Value</li>
}
</ul>
}
<p>@_surnameMessage</p>
@code {
private string _authMessage;
private string _surnameMessage;
private IEnumerable<Claim> _claims = Enumerable.Empty<Claim>();
private async Task GetClaimsPrincipalData()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
_authMessage = $"{user.Identity.Name} is authenticated.";
_claims = user.Claims;
_surnameMessage =
$"Surname: {user.FindFirst(c => c.Type == ClaimTypes.Surname)?.Value}";
}
else
{
_authMessage = "The user is NOT authenticated.";
}
}
}