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>