Forcer le flux interactif dans la modal d'authentification

This commit is contained in:
2026-04-13 23:38:05 +02:00
parent f2fdf00cb9
commit e3d0a9faf2
2 changed files with 41 additions and 12 deletions

View File

@@ -84,6 +84,8 @@
private string LoginHref => BuildAuthHref("login", EffectiveReturnUrl);
private string RegisterHref => BuildAuthHref("register", EffectiveReturnUrl);
private string LoginModalSrc => BuildAuthHref("login", EffectiveReturnUrl, embedded: true);
private string RegisterModalSrc => BuildAuthHref("register", EffectiveReturnUrl, embedded: true);
private string LogoutHref => BuildAuthHref("logout", "/");
private string CurrentPath
@@ -120,8 +122,16 @@
private bool IsCurrentPage(string[] paths)
=> paths.Any(path => string.Equals(CurrentPath, path, StringComparison.OrdinalIgnoreCase));
private static string BuildAuthHref(string action, string returnUrl)
=> $"authentication/{action}?returnUrl={Uri.EscapeDataString(returnUrl)}";
private static string BuildAuthHref(string action, string returnUrl, bool embedded = false)
{
var query = $"returnUrl={Uri.EscapeDataString(returnUrl)}";
if (embedded)
{
query += "&embedded=1";
}
return $"authentication/{action}?{query}";
}
private static string BuildDisplayName(ClaimsPrincipal user)
=> user.Identity?.Name
@@ -141,10 +151,10 @@
}
private async Task OpenLoginModal()
=> await OpenAuthModalAsync("Se connecter", LoginHref);
=> await OpenAuthModalAsync("Se connecter", LoginModalSrc);
private async Task OpenRegisterModal()
=> await OpenAuthModalAsync("Creer un compte", RegisterHref);
=> await OpenAuthModalAsync("Creer un compte", RegisterModalSrc);
private async Task OpenAuthModalAsync(string title, string source)
{