From 943808562fdd921339a1740b024b9fbd3f6a2092 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Tue, 14 Jan 2020 18:56:23 -0600 Subject: [PATCH] fix error code page for things over than 404s allow request token when not logged in --- Plugins/Login/Plugin.cs | 6 +++++- Plugins/Stats/Cheat/Thresholds.cs | 4 ++-- WebfrontCore/Startup.cs | 13 ++++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Plugins/Login/Plugin.cs b/Plugins/Login/Plugin.cs index f5e268a03..91fe6c360 100644 --- a/Plugins/Login/Plugin.cs +++ b/Plugins/Login/Plugin.cs @@ -2,6 +2,7 @@ using System.Reflection; using System.Threading.Tasks; using SharedLibraryCore; +using SharedLibraryCore.Commands; using SharedLibraryCore.Configuration; using SharedLibraryCore.Database.Models; using SharedLibraryCore.Exceptions; @@ -42,13 +43,16 @@ namespace IW4MAdmin.Plugins.Login E.Origin.Level == EFClient.Permission.Console) return Task.CompletedTask; - if (((Command)E.Extra).Name == new SharedLibraryCore.Commands.CSetPassword().Name && + if (((Command)E.Extra).Name == new CSetPassword().Name && E.Origin?.Password == null) return Task.CompletedTask; if (((Command)E.Extra).Name == new Commands.CLogin().Name) return Task.CompletedTask; + if (E.Extra.GetType() == typeof(RequestTokenCommand)) + return Task.CompletedTask; + if (!AuthorizedClients[E.Origin.ClientId]) { throw new AuthorizationException(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_LOGIN_AUTH"]); diff --git a/Plugins/Stats/Cheat/Thresholds.cs b/Plugins/Stats/Cheat/Thresholds.cs index 8ef5df298..37f2c9601 100644 --- a/Plugins/Stats/Cheat/Thresholds.cs +++ b/Plugins/Stats/Cheat/Thresholds.cs @@ -48,8 +48,8 @@ namespace IW4MAdmin.Plugins.Stats.Cheat public const int HighSampleMinKills = 100; public const double KillTimeThreshold = 0.2; public const int LowSampleMinKillsRecoil = 5; - public const double SnapFlagValue = 5.5; - public const double SnapBanValue = 8.7; + public const double SnapFlagValue = 7.6; + public const double SnapBanValue = 11.7; public const double MaxStrainBan = 0.9; diff --git a/WebfrontCore/Startup.cs b/WebfrontCore/Startup.cs index 04e769815..42cc5cfba 100644 --- a/WebfrontCore/Startup.cs +++ b/WebfrontCore/Startup.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.Extensions.Configuration; @@ -8,6 +9,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using SharedLibraryCore.Database; using SharedLibraryCore.Interfaces; +using System.Net; +using System.Threading.Tasks; using WebfrontCore.Middleware; namespace WebfrontCore @@ -95,7 +98,15 @@ namespace WebfrontCore // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { - app.UseStatusCodePagesWithRedirects("/Home/ResponseStatusCode?statusCode={0}"); + app.UseStatusCodePages(_context => + { + if (_context.HttpContext.Response.StatusCode == (int)HttpStatusCode.NotFound) + { + _context.HttpContext.Response.Redirect($"/Home/ResponseStatusCode?statusCode={_context.HttpContext.Response.StatusCode}"); + } + + return Task.CompletedTask; + }); if (env.EnvironmentName == "Development") {