allow Admin to navigate to login page

This commit is contained in:
sbwalker 2024-03-04 08:34:10 -05:00
parent 48b70d0254
commit 6072eab01d

View File

@ -12,6 +12,9 @@
<Authorizing> <Authorizing>
<text>...</text> <text>...</text>
</Authorizing> </Authorizing>
<Authorized>
<ModuleMessage Message="@Localizer["Info.SignedIn"]" Type="MessageType.Info" />
</Authorized>
<NotAuthorized> <NotAuthorized>
@if (!twofactor) @if (!twofactor)
{ {
@ -166,12 +169,14 @@
{ {
if (firstRender && PageState.User == null && _allowsitelogin) if (firstRender && PageState.User == null && _allowsitelogin)
{ {
if(!string.IsNullOrEmpty(username.Id)) if (!string.IsNullOrEmpty(username.Id)) // ensure username is visible in UI
{
await username.FocusAsync(); await username.FocusAsync();
}
} }
// redirect logged in user to specified page // redirect logged in user to specified page
if (PageState.User != null) if (PageState.User != null && !UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{ {
NavigationManager.NavigateTo(PageState.ReturnUrl); NavigationManager.NavigateTo(PageState.ReturnUrl);
} }