Skip to content

Commit

Permalink
Merge pull request #4543 from sbwalker/dev
Browse files Browse the repository at this point in the history
fix login redirect issue in sub-site where user has navigated directly to login page
  • Loading branch information
sbwalker authored Aug 21, 2024
2 parents f936d4c + 66acb55 commit 9f0b755
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 9f0b755

Please # to comment.