fix error code page for things over than 404s

allow request token when not logged in
This commit is contained in:
RaidMax 2020-01-14 18:56:23 -06:00
parent ec994d51be
commit 943808562f
3 changed files with 19 additions and 4 deletions

View File

@ -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"]);

View File

@ -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;

View File

@ -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")
{