Permalink
Browse files

App::Comments::_extend_commenter_session: removing support for days/s…

…econds session extension, bugid:107749
  • Loading branch information...
1 parent 6e947cf commit 0ddb3e18eba620a75faf33a9e803d2d9a0db1780 @semuel semuel committed Apr 10, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 lib/MT/App/Comments.pm
View
@@ -1241,17 +1241,15 @@ sub _extend_commenter_session {
my %cookies = $app->cookies();
my $cookie_name = $app->commenter_cookie;
my $session_key = $app->cookie_val($cookie_name) || "";
+ my $duration = $param{Duration};
+ die "Support only one year session extension"
+ unless $duration eq "+1y";
$session_key =~ y/+/ /;
my $sessobj = MT::Session->load( { id => $session_key, kind => 'SI' } );
return
if !$sessobj
; # no point changing the cookie if the session's already lost.
- my ( $sign, $number, $units ) = $param{Duration} =~ /([+-]?)(\d+)(\w+)/;
- $number *= $sign eq '-' ? -1 : +1;
- $number *=
- $units eq 'y' ? 60 * 60 * 24 * 365
- : $units eq 'd' ? 60 * 60 * 24
- : 1; # 's'
+ my $number = 60 * 60 * 24 * 365; # one year
$sessobj->start( $sessobj->start + $number );
$sessobj->save();
my %sess_cookie = (

0 comments on commit 0ddb3e1

Please sign in to comment.