refactor visitor cookie name into a shared constant
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user