Ajout des acces connexion et inscription sur l'accueil
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"realm": "chesscubing",
|
||||
"enabled": true,
|
||||
"displayName": "ChessCubing",
|
||||
"registrationAllowed": false,
|
||||
"registrationAllowed": true,
|
||||
"rememberMe": true,
|
||||
"resetPasswordAllowed": true,
|
||||
"loginWithEmailAllowed": true,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user