Remove broken and useless BlockDeniedUsers functionality

This commit is contained in:
jvyden 2022-05-15 00:13:40 -04:00
parent 3e031a342f
commit 71a97894ad
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
5 changed files with 6 additions and 60 deletions

View file

@ -79,22 +79,6 @@ public class LoginController : ControllerBase
if (ServerConfiguration.Instance.Authentication.UseExternalAuth)
{
if (ServerConfiguration.Instance.Authentication.BlockDeniedUsers)
{
string ipAddressAndName = $"{token.UserLocation}|{user.Username}";
if (DeniedAuthenticationHelper.RecentlyDenied(ipAddressAndName) || DeniedAuthenticationHelper.GetAttempts(ipAddressAndName) > 3)
{
this.database.AuthenticationAttempts.RemoveRange
(this.database.AuthenticationAttempts.Include(a => a.GameToken).Where(a => a.GameToken.UserId == user.UserId));
DeniedAuthenticationHelper.AddAttempt(ipAddressAndName);
await this.database.SaveChangesAsync();
Logger.LogWarn($"Too many recent denied logins from user {user.Username}, rejecting login", LogArea.Login);
return this.StatusCode(403, "");
}
}
if (this.database.UserApprovedIpAddresses.Where(a => a.UserId == user.UserId).Select(a => a.IpAddress).Contains(ipAddress))
{
token.Approved = true;