Ajout des acces connexion et inscription sur l'accueil

This commit is contained in:
2026-04-13 22:42:17 +02:00
parent 6202b8b829
commit 6c3b9b77c6
6 changed files with 38 additions and 14 deletions

View File

@@ -1,20 +1,32 @@
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(Pages.NotFound)">
<Found Context="routeData">
<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>
@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)" />
}
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
</Router>
</CascadingAuthenticationState>
@code {
private static bool RequiresAuthorization(Type pageType)
=> Attribute.IsDefined(pageType, typeof(AuthorizeAttribute), inherit: true);
}

View File

@@ -23,6 +23,7 @@
</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>
</NotAuthorized>
@@ -30,6 +31,7 @@
@code {
private string LoginHref => BuildAuthHref("login", CurrentReturnUrl);
private string RegisterHref => BuildAuthHref("register", CurrentReturnUrl);
private string LogoutHref => BuildAuthHref("logout", "/");
private string CurrentReturnUrl

View File

@@ -24,6 +24,10 @@
</p>
<div class="hero-actions">
<a class="button primary" href="application.html">Ouvrir l'application</a>
<a class="button secondary" href="authentication/login?returnUrl=%2Fapplication.html">Se connecter</a>
<a class="button ghost" href="authentication/register?returnUrl=%2Fapplication.html">Creer un compte</a>
</div>
<div class="hero-actions hero-actions-utility">
<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>

View File

@@ -35,6 +35,7 @@ L'application embarque maintenant une authentification OpenID Connect basee sur
- les pages `application.html`, `chrono.html` et `cube.html` demandent une connexion
- la page d'accueil et la page reglement affichent l'etat de session courant
- la page d'accueil propose directement des actions `Se connecter` et `Creer un compte`
- les roles Keycloak du realm sont exposes dans l'application
- l'etat du match est isole par utilisateur dans le navigateur grace a une cle de stockage derivee du compte connecte
@@ -43,6 +44,7 @@ Le realm importe par defaut :
- realm : `chesscubing`
- client public OIDC : `chesscubing-web`
- roles de realm : `admin`, `organizer`, `player`
- inscription utilisateur : activee
La gestion des utilisateurs se fait ensuite dans la console d'administration Keycloak.

View File

@@ -2,7 +2,7 @@
"realm": "chesscubing",
"enabled": true,
"displayName": "ChessCubing",
"registrationAllowed": false,
"registrationAllowed": true,
"rememberMe": true,
"resetPasswordAllowed": true,
"loginWithEmailAllowed": true,

View File

@@ -1047,6 +1047,10 @@ body[data-page="cube"] .zone-button.cube-hold-ready::after {
margin-top: 1.2rem;
}
.hero-actions-utility {
margin-top: 0.75rem;
}
.user-access-bar {
display: grid;
gap: 0.9rem;