From 08020cb6263212121d7ffdccc3b128ab35a4a329 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 1 Feb 2022 16:28:23 +0100
Subject: [PATCH] switch from Net::IP to Mojo::Util

---
 lib/AccountManager/App/Status.pm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/AccountManager/App/Status.pm b/lib/AccountManager/App/Status.pm
index 38d755c..e4e680e 100644
--- a/lib/AccountManager/App/Status.pm
+++ b/lib/AccountManager/App/Status.pm
@@ -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"
-- 
GitLab