prevent logging of error for personalized pages

This commit is contained in:
sbwalker 2023-07-10 14:51:32 -04:00
parent 66d07fbed3
commit 62ad99d0b6
2 changed files with 8 additions and 6 deletions

View File

@ -143,9 +143,8 @@ namespace Oqtane.Controllers
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Get Attempt {Name} For Folder {FolderId}", name, folderId);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
file = null;
}
return file;
return null;
}
}

View File

@ -106,8 +106,11 @@ namespace Oqtane.Controllers
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Page Get Attempt {SiteId} {Path}", siteid, path);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
if (page != null)
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Page Get Attempt {SiteId} {Path}", siteid, path);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
}
return null;
}
}
@ -177,8 +180,8 @@ namespace Oqtane.Controllers
page = new Page();
page.SiteId = parent.SiteId;
page.ParentId = parent.PageId;
page.Name = user.DisplayName != null ? user.DisplayName : user.Username;
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(page.Name);
page.Name = user.Username;
page.Path = parent.Path + "/" + page.Name;
page.Title = page.Name + " - " + parent.Name;
page.Order = 0;
page.IsNavigation = false;