Fix IP access middleware

This commit is contained in:
Dane Everitt 2018-02-28 23:39:59 -06:00
parent 9b93629f45
commit 8f72571895
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 6 additions and 6 deletions

View file

@ -29,12 +29,12 @@ class AuthenticateIPAccess
}
$find = new IP($request->ip());
foreach ($model->allowed_ips as $ip) {
foreach (json_decode($model->allowed_ips) as $ip) {
if (Range::parse($ip)->contains($find)) {
return $next($request);
}
}
throw new AccessDeniedHttpException('This IP address does not have permission to access the API using these credentials.');
throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.');
}
}