Merge pull request #2585 from sbwalker/dev
refactor visitor cookie name into a shared constant
This commit is contained in:
commit
eb876845ff
@ -237,7 +237,7 @@ else
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (!firstRender)
|
||||
if (firstRender)
|
||||
{
|
||||
// external link to log item will display Details component
|
||||
if (PageState.QueryString.ContainsKey("id") && int.TryParse(PageState.QueryString["id"], out int id))
|
||||
|
@ -46,7 +46,7 @@ namespace Oqtane.Controllers
|
||||
_identityCache = identityCache;
|
||||
_logger = logger;
|
||||
_alias = tenantManager.GetAlias();
|
||||
_visitorCookie = "APP_VISITOR_" + _alias.SiteId.ToString();
|
||||
_visitorCookie = Constants.VisitorCookiePrefix + _alias.SiteId.ToString();
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
|
@ -50,7 +50,7 @@ namespace Oqtane.Controllers
|
||||
bool authorized = User.IsInRole(RoleNames.Admin);
|
||||
if (!authorized)
|
||||
{
|
||||
var visitorCookie = "APP_VISITOR_" + _alias.SiteId.ToString();
|
||||
var visitorCookie = Constants.VisitorCookiePrefix + _alias.SiteId.ToString();
|
||||
if (int.TryParse(Request.Cookies[visitorCookie], out int visitorId))
|
||||
{
|
||||
authorized = (visitorId == id);
|
||||
|
@ -284,7 +284,7 @@ namespace Oqtane.Pages
|
||||
// check if cookie already exists
|
||||
Visitor visitor = null;
|
||||
bool addcookie = false;
|
||||
var VisitorCookie = "APP_VISITOR_" + SiteId.ToString();
|
||||
var VisitorCookie = Constants.VisitorCookiePrefix + SiteId.ToString();
|
||||
if (!int.TryParse(Request.Cookies[VisitorCookie], out VisitorId))
|
||||
{
|
||||
// if enabled use IP Address correlation
|
||||
|
@ -73,6 +73,7 @@ namespace Oqtane.Shared
|
||||
public static readonly string HttpContextSiteSettingsKey = "SiteSettings";
|
||||
|
||||
public static readonly string MauiUserAgent = "MAUI";
|
||||
public static readonly string VisitorCookiePrefix = "APP_VISITOR_";
|
||||
|
||||
// Obsolete constants
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user