Skip to content
Snippets Groups Projects
Commit 08020cb6 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

switch from Net::IP to Mojo::Util

parent bd9b0ccc
Branches
Tags
No related merge requests found
......@@ -16,7 +16,7 @@ use Mojo::Base qw(AccountManager::App::Controller);
use English qw(-no_match_vars);
use List::MoreUtils qw(none);
use Net::IP;
use Mojo::Util qw(network_contains);
use Sys::Hostname;
use Syntax::Keyword::Try;
......@@ -41,12 +41,10 @@ sub run {
return;
}
my $client_ip = Net::IP->new($self->client_ip());
my @allowed_ips =
map { Net::IP->new($_) }
$self->string_to_list($config->{status}->{allowed});
my $client_ip = $self->client_ip();
my @allowed_ips = $self->string_to_list($config->{status}->{allowed});
if (none { $_->overlaps($client_ip) } @allowed_ips) {
if (none { network_contains($_, $client_ip) } @allowed_ips) {
$self->render(
status => 403,
test => "unauthorized access"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment