Skip to content

Commit

Permalink
fix login redirect issue in sub-site where user has navigated directl…
Browse files Browse the repository at this point in the history
…y to login page
  • Loading branch information
sbwalker committed Aug 21, 2024
1 parent c3ddb8d commit 66acb55
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Oqtane.Client/Modules/Admin/#/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,20 @@
{
await logger.LogInformation(LogFunction.Security, "Login Successful For Username {Username}", _username);

// return url is not specified if user navigated directly to login page
var returnurl = (!string.IsNullOrEmpty(PageState.ReturnUrl)) ? PageState.ReturnUrl : PageState.Alias.Path;

if (hybrid)
{
// hybrid apps utilize an interactive login
var authstateprovider = (IdentityAuthenticationStateProvider)ServiceProvider.GetService(typeof(IdentityAuthenticationStateProvider));
authstateprovider.NotifyAuthenticationChanged();
NavigationManager.NavigateTo(NavigateUrl(PageState.ReturnUrl, true));
NavigationManager.NavigateTo(NavigateUrl(returnurl, true));
}
else
{
// post back to the Login page so that the cookies are set correctly
var fields = new { __RequestVerificationToken = SiteState.AntiForgeryToken, username = _username, password = _password, remember = _remember, returnurl = WebUtility.UrlEncode(PageState.ReturnUrl) };
var fields = new { __RequestVerificationToken = SiteState.AntiForgeryToken, username = _username, password = _password, remember = _remember, returnurl = WebUtility.UrlEncode(returnurl) };
string url = Utilities.TenantUrl(PageState.Alias, "/pages/#/");
await interop.SubmitForm(url, fields);
}
Expand Down

0 comments on commit 66acb55

Please # to comment.