fix #4284 - handle user role effective and expiry date
This commit is contained in:
@ -39,7 +39,7 @@
|
||||
}
|
||||
_comment += " -->";
|
||||
|
||||
if (PageState.RenderMode != RenderModes.Static || ModuleState.RenderMode != RenderModes.Static)
|
||||
if (PageState.RenderMode == RenderModes.Static && ModuleState.RenderMode == RenderModes.Interactive)
|
||||
{
|
||||
// trim PageState to mitigate page bloat caused by Blazor serializing/encrypting state when crossing render mode boundaries
|
||||
// please note that this performance optimization results in the PageState.Pages property not being available for use in Interactive components
|
||||
|
@ -2,6 +2,7 @@
|
||||
@using System.Net
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using System.Globalization
|
||||
@using System.Security.Claims
|
||||
@namespace Oqtane.UI
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject SiteState SiteState
|
||||
@ -159,7 +160,8 @@
|
||||
if (authState.User.Identity.IsAuthenticated && authState.User.Claims.Any(item => item.Type == "sitekey" && item.Value == SiteState.Alias.SiteKey))
|
||||
{
|
||||
// get user
|
||||
user = await UserService.GetUserAsync(authState.User.Identity.Name, SiteState.Alias.SiteId);
|
||||
var userid = int.Parse(authState.User.Claims.First(item => item.Type == ClaimTypes.NameIdentifier).Value);
|
||||
user = await UserService.GetUserAsync(userid, SiteState.Alias.SiteId);
|
||||
if (user != null)
|
||||
{
|
||||
user.IsAuthenticated = authState.User.Identity.IsAuthenticated;
|
||||
|
Reference in New Issue
Block a user