mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-07 12:28:39 +00:00
Add read-only check to /postComment in slot page controller
This commit is contained in:
parent
83ca4ce9c8
commit
773b414a13
1 changed files with 4 additions and 1 deletions
|
@ -10,7 +10,7 @@ using LBPUnion.ProjectLighthouse.Types.Logging;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
// I would like to apologize in advance for anyone dealing with this file.
|
||||
// I would like to apologize in advance for anyone dealing with this file.
|
||||
// Theres probably a better way to do this with delegates but I'm tired.
|
||||
// TODO: Clean up this file
|
||||
// - jvyden
|
||||
|
@ -63,6 +63,9 @@ public class SlotPageController : ControllerBase
|
|||
WebTokenEntity? token = this.database.WebTokenFromRequest(this.Request);
|
||||
if (token == null) return this.Redirect("~/login");
|
||||
|
||||
// Deny request if in read-only mode
|
||||
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.Redirect("~/slot/" + id);
|
||||
|
||||
if (msg == null)
|
||||
{
|
||||
Logger.Error($"Refusing to post comment from {token.UserId} on level {id}, {nameof(msg)} is null", LogArea.Comments);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue