mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-12 21:02:27 +00:00
Revert website Forbid and Unauthorized method usage to StatusCode
This is because by default ASP.NET expects an authentication scheme to be registered when using these methods.
This commit is contained in:
parent
50d1d9c7e5
commit
c34b7f3e79
5 changed files with 8 additions and 8 deletions
|
@ -105,7 +105,7 @@ public class UserEndpoints : ApiEndpointController
|
|||
string authToken = authHeader[(authHeader.IndexOf(' ') + 1)..];
|
||||
|
||||
ApiKeyEntity? apiKey = await this.database.APIKeys.FirstOrDefaultAsync(k => k.Key == authToken);
|
||||
if (apiKey == null) return this.Unauthorized();
|
||||
if (apiKey == null) return this.StatusCode(403);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ public class AdminReportController : ControllerBase
|
|||
public async Task<IActionResult> DeleteReport([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsAdmin) return this.Forbid();
|
||||
if (user == null || !user.IsAdmin) return this.StatusCode(403);
|
||||
|
||||
GriefReportEntity? report = await this.database.Reports.FirstOrDefaultAsync(r => r.ReportId == id);
|
||||
if (report == null) return this.NotFound();
|
||||
|
@ -50,7 +50,7 @@ public class AdminReportController : ControllerBase
|
|||
public async Task<IActionResult> DismissReport([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Forbid();
|
||||
if (user == null || !user.IsModerator) return this.StatusCode(403);
|
||||
|
||||
GriefReportEntity? report = await this.database.Reports.FirstOrDefaultAsync(r => r.ReportId == id);
|
||||
if (report == null) return this.NotFound();
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ModerationCaseController : ControllerBase
|
|||
public async Task<IActionResult> DismissCase([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Forbid();
|
||||
if (user == null || !user.IsModerator) return this.StatusCode(403);
|
||||
|
||||
ModerationCaseEntity? @case = await this.database.Cases.FirstOrDefaultAsync(c => c.CaseId == id);
|
||||
if (@case == null) return this.NotFound();
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> TeamPick([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
if (user == null || !user.IsModerator) return this.StatusCode(403);
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.Include(s => s.Creator).FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.NotFound();
|
||||
|
@ -43,7 +43,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> RemoveTeamPick([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
if (user == null || !user.IsModerator) return this.StatusCode(403);
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.NotFound();
|
||||
|
@ -59,7 +59,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> DeleteLevel([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
if (user == null || !user.IsModerator) return this.StatusCode(403);
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.Ok();
|
||||
|
|
|
@ -18,7 +18,7 @@ public class AuthenticationPage : BaseLayout
|
|||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
if (this.User == null) return this.Forbid();
|
||||
if (this.User == null) return this.Redirect("~/login");
|
||||
|
||||
this.IpAddress = this.HttpContext.Connection.RemoteIpAddress;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue