Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…econds session extension, bugid:107749
  • Loading branch information...
commit 0ddb3e18eba620a75faf33a9e803d2d9a0db1780 1 parent 6e947cf
@semuel semuel authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 lib/MT/App/Comments.pm
View
10 lib/MT/App/Comments.pm
@@ -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 = (
Please sign in to comment.
Something went wrong with that request. Please try again.