Skip to content

Commit

Permalink
Fixed last commit not working with users generated via OpenBullet Adm…
Browse files Browse the repository at this point in the history
…in Panel.
  • Loading branch information
openbullet committed May 20, 2019
1 parent 16daebc commit be62fd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions OpenBulletAPI/Controllers/ConfigsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit be62fd3

Please sign in to comment.