aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/CatDap/Controller/admin.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CatDap/Controller/admin.pm b/lib/CatDap/Controller/admin.pm
index b324421..2ae362b 100644
--- a/lib/CatDap/Controller/admin.pm
+++ b/lib/CatDap/Controller/admin.pm
@@ -47,7 +47,15 @@ sub auto : Private {
my $password;
my $mesg;
my $dn;
- my $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address );
+ my $keyprefix;
+ if ($c->req->address =~ m/:/) {
+ my $address = $c->req->address;
+ $address =~ s/\[\]://;
+ $keyprefix = sprintf( "%06x", $address >> 104 ); # if we shift right 104 bits from 128 we have 24 bits left or 3 bytes.
+ }
+ else {
+ $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address );
+ }
if ( !defined $c->user or not $c->req->cookie('key') ) {
$c->detach('/user/login')
if ( not $c->req->param('username')