Forcer le flux interactif dans la modal d'authentification
This commit is contained in:
@@ -5,11 +5,15 @@
|
||||
<main class="rules-shell">
|
||||
<section class="panel panel-wide cta-panel" style="margin-top: 2rem;">
|
||||
<p class="eyebrow">Authentification</p>
|
||||
@if (IsRegisterAction)
|
||||
@if (StartsInteractiveFlow)
|
||||
{
|
||||
<div>
|
||||
<strong>Redirection vers la creation de compte...</strong>
|
||||
<p>L'inscription se poursuit dans Keycloak, puis vous reviendrez automatiquement dans l'application.</p>
|
||||
<strong>@(IsRegisterAction ? "Ouverture de la creation de compte..." : "Ouverture de la connexion...")</strong>
|
||||
<p>
|
||||
@(IsRegisterAction
|
||||
? "Le formulaire Keycloak s'ouvre dans cette fenetre integree."
|
||||
: "Le formulaire de connexion Keycloak s'ouvre dans cette fenetre integree.")
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
@@ -26,12 +30,25 @@
|
||||
[SupplyParameterFromQuery(Name = "returnUrl")]
|
||||
public string? ReturnUrl { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery(Name = "embedded")]
|
||||
public string? Embedded { get; set; }
|
||||
|
||||
private bool IsRegisterAction
|
||||
=> string.Equals(Action, RemoteAuthenticationActions.Register, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private bool IsLoginAction
|
||||
=> string.Equals(Action, RemoteAuthenticationActions.LogIn, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private bool IsEmbeddedFlow
|
||||
=> string.Equals(Embedded, "1", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(Embedded, "true", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private bool StartsInteractiveFlow
|
||||
=> IsEmbeddedFlow && (IsLoginAction || IsRegisterAction);
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (!IsRegisterAction)
|
||||
if (!StartsInteractiveFlow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -42,7 +59,11 @@
|
||||
ReturnUrl = NormalizeReturnUrl(ReturnUrl)
|
||||
};
|
||||
|
||||
request.TryAddAdditionalParameter("prompt", "create");
|
||||
if (IsRegisterAction)
|
||||
{
|
||||
request.TryAddAdditionalParameter("prompt", "create");
|
||||
}
|
||||
|
||||
Navigation.NavigateToLogin("authentication/login", request);
|
||||
}
|
||||
|
||||
@@ -60,13 +81,11 @@
|
||||
_ => null,
|
||||
};
|
||||
|
||||
if (status is null)
|
||||
if (status is null || !IsEmbeddedFlow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(700);
|
||||
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("chesscubingAuthModal.notifyParent", status);
|
||||
|
||||
Reference in New Issue
Block a user