Forcer le flux interactif dans la modal d'authentification
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user