Rendre le site public et restaurer les acces compte

This commit is contained in:
2026-04-13 22:52:08 +02:00
parent 1d0a3f551f
commit 525f804e0b
8 changed files with 34 additions and 34 deletions

View File

@@ -1,32 +1,8 @@
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
@if (RequiresAuthorization(routeData.PageType))
{
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)">
<Authorizing>
<main class="rules-shell">
<section class="panel panel-wide cta-panel" style="margin-top: 2rem;">
<p class="eyebrow">Authentification</p>
<h1>Verification de la session en cours...</h1>
</section>
</main>
</Authorizing>
<NotAuthorized>
<RedirectToLogin />
</NotAuthorized>
</AuthorizeRouteView>
}
else
{
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)" />
}
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
</Router>
</CascadingAuthenticationState>
@code {
private static bool RequiresAuthorization(Type pageType)
=> Attribute.IsDefined(pageType, typeof(AuthorizeAttribute), inherit: true);
}

View File

@@ -14,12 +14,25 @@
</div>
</div>
</Authorized>
<Authorizing>
<div class="user-access-bar">
<div class="user-access-copy">
<span class="micro-label">Compte Keycloak</span>
<strong>Connexion optionnelle</strong>
<span class="user-access-meta">Le site reste accessible sans connexion. Vous pouvez vous connecter ou creer un compte si besoin.</span>
</div>
<div class="user-access-actions">
<a class="button primary small" href="@LoginHref">Se connecter</a>
<a class="button ghost small" href="@RegisterHref">Creer un compte</a>
</div>
</div>
</Authorizing>
<NotAuthorized>
<div class="user-access-bar">
<div class="user-access-copy">
<span class="micro-label">Compte Keycloak</span>
<strong>Connexion requise pour lancer et reprendre les matchs</strong>
<span class="user-access-meta">Chaque compte conserve son propre etat de match dans ce navigateur.</span>
<strong>Connexion optionnelle</strong>
<span class="user-access-meta">Le site reste accessible sans connexion. Chaque compte conserve son propre etat de match dans ce navigateur.</span>
</div>
<div class="user-access-actions">
<a class="button primary small" href="@LoginHref">Se connecter</a>

View File

@@ -1,6 +1,5 @@
@page "/application"
@page "/application.html"
@attribute [Authorize]
@inject BrowserBridge Browser
@inject MatchStore Store
@inject NavigationManager Navigation

View File

@@ -1,6 +1,5 @@
@page "/chrono"
@page "/chrono.html"
@attribute [Authorize]
@implements IAsyncDisposable
@inject MatchStore Store
@inject NavigationManager Navigation

View File

@@ -1,6 +1,5 @@
@page "/cube"
@page "/cube.html"
@attribute [Authorize]
@implements IAsyncDisposable
@inject BrowserBridge Browser
@inject MatchStore Store

View File

@@ -22,13 +22,19 @@
passe par une phase cube obligatoire, puis la partie repart avec un
nouveau rythme.
</p>
<UserAccessBar ReturnUrl="/application.html" />
<div class="hero-actions">
<a class="button primary" href="application.html">Ouvrir l'application</a>
<a class="button secondary" href="reglement.html">Lire le reglement</a>
<a class="button ghost" href="/ethan/">Ouvrir l'appli d'Ethan</a>
<a class="button ghost" href="/brice/">Ouvrir l'appli de Brice</a>
</div>
<div class="hero-account-actions">
<span class="micro-label">Compte Keycloak</span>
<div class="hero-account-buttons">
<a class="button secondary small" href="authentication/login?returnUrl=%2Fapplication.html">Se connecter</a>
<a class="button ghost small" href="authentication/register?returnUrl=%2Fapplication.html">Creer un compte</a>
</div>
</div>
</div>
<aside class="hero-preview">