From be62fd3486237988817d81cb569e5cb90314d197 Mon Sep 17 00:00:00 2001 From: ruri Date: Tue, 21 May 2019 00:03:50 +0200 Subject: [PATCH] Fixed last commit not working with users generated via OpenBullet Admin Panel. --- OpenBulletAPI/Controllers/ConfigsController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenBulletAPI/Controllers/ConfigsController.cs b/OpenBulletAPI/Controllers/ConfigsController.cs index 74d81c3..50ddc35 100644 --- a/OpenBulletAPI/Controllers/ConfigsController.cs +++ b/OpenBulletAPI/Controllers/ConfigsController.cs @@ -48,16 +48,16 @@ private string[] GetGroups() // Check the IP if the IPs whitelist is not blank var ip = Request.HttpContext.Connection.RemoteIpAddress.ToString(); - if (user.IPs != null) + if (user.IPs != null && user.IPs.Count(i => !string.IsNullOrWhiteSpace(i)) > 0) { - if (user.IPs.Where(i => i != null && i.Trim() != "").Count() > 0 && !user.IPs.Contains(ip)) + if (!user.IPs.Contains(ip)) { throw new Exception("Unauthorized IP"); } } // If we set AutoBindFirstIP to true, add the current IP to the array - if (_appSettings.AutoBindFirstIP && user.IPs == null) + if (_appSettings.AutoBindFirstIP && (user.IPs == null || user.IPs.Count(i => !string.IsNullOrWhiteSpace(i)) == 0)) { user.IPs = new string[] { ip }; _userService.UpdateUser(user);