[Mageia-sysadm] [135] - factorise the code who deal with ip ( so we can change it at one place for ipv6 support )
root at mageia.org
root at mageia.org
Thu Nov 25 00:03:07 CET 2010
Revision: 135
Author: misc
Date: 2010-11-25 00:03:07 +0100 (Thu, 25 Nov 2010)
Log Message:
-----------
- factorise the code who deal with ip ( so we can change it at one place for ipv6 support )
Modified Paths:
--------------
identity/CatDap/trunk/lib/CatDap/Controller/user.pm
Modified: identity/CatDap/trunk/lib/CatDap/Controller/user.pm
===================================================================
--- identity/CatDap/trunk/lib/CatDap/Controller/user.pm 2010-11-24 19:26:09 UTC (rev 134)
+++ identity/CatDap/trunk/lib/CatDap/Controller/user.pm 2010-11-24 23:03:07 UTC (rev 135)
@@ -55,7 +55,7 @@
my $mesg;
my $dn;
my @errors;
- my $keyprefix = sprintf("%02x%02x%02x",split /\./,$c->req->address);
+ my $keyprefix = $self->get_keyprefix($c);
if (! defined $c->user or not $c->req->cookie('key')) {
if (not $c->req->param('password')) {
push @errors,$c->loc('Your session has expired');
@@ -112,6 +112,10 @@
}
+sub get_keyprefix : Private {
+ my ( $self, $c ) = @_;
+ return sprintf("%02x%02x%02x",split /\./,$c->req->address);
+}
=head2 index
=cut
@@ -286,7 +290,7 @@
} else {
# re-encrypt the new password and forward to user view
- my $keyprefix = sprintf("%02x%02x%02x",split /\./,$c->req->address);
+ my $keyprefix = $self->get_keyprefix($c);
my $key = $c->req->cookie('key')->value;
$cipher = Crypt::CBC->new( -key => $keyprefix . $key,
-cipher => 'Blowfish'
@@ -314,7 +318,7 @@
$c->res->redirect('/user');
}
# cache password for next request with form data
- my $keyprefix = sprintf("%02x%02x%02x",split /\./,$c->req->address);
+ my $keyprefix = $self->get_keyprefix($c);
my $key = Data::UUID->new->create_str();
$cipher = Crypt::CBC->new( -key => $keyprefix . $key,
-cipher => 'Blowfish'
@@ -331,7 +335,7 @@
}
#Re-authenticate user
- my $keyprefix = sprintf("%02x%02x%02x",split /\./,$c->req->address);
+ my $keyprefix = $self->get_keyprefix($c);
my $key = $c->req->cookie('key')->value;
$cipher = Crypt::CBC->new( -key => $keyprefix . $key,
-cipher => 'Blowfish'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101125/fa7a0339/attachment.html>
More information about the Mageia-sysadm
mailing list