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>
|
||||
|
||||
Reference in New Issue
Block a user