View | Details | Raw Unified | Return to bug 29915
Collapse All | Expand All

(-)a/C4/Auth.pm (-2 / +4 lines)
Lines 958-964 sub checkauth { Link Here
958
958
959
    unless ( $userid ) {
959
    unless ( $userid ) {
960
        #we initiate a session prior to checking for a username to allow for anonymous sessions...
960
        #we initiate a session prior to checking for a username to allow for anonymous sessions...
961
        $session ||= get_session("") or die "Auth ERROR: Cannot get_session()";
961
        if( !$session or !$sessionID ) { # if we cleared sessionID, we need a new session
962
            $session = get_session() or die "Auth ERROR: Cannot get_session()";
963
        }
962
964
963
        # Save anonymous search history in new session so it can be retrieved
965
        # Save anonymous search history in new session so it can be retrieved
964
        # by get_template_and_user to store it in user's search history after
966
        # by get_template_and_user to store it in user's search history after
Lines 1793-1799 sub get_session { Link Here
1793
        $session = CGI::Session->load( $params->{dsn}, $sessionID, $params->{dsn_args} );
1795
        $session = CGI::Session->load( $params->{dsn}, $sessionID, $params->{dsn_args} );
1794
    } else {
1796
    } else {
1795
        $session = CGI::Session->new( $params->{dsn}, $sessionID, $params->{dsn_args} );
1797
        $session = CGI::Session->new( $params->{dsn}, $sessionID, $params->{dsn_args} );
1796
        # $session->flush;
1798
        # no need to flush here
1797
    }
1799
    }
1798
    return $session;
1800
    return $session;
1799
}
1801
}
(-)a/t/db_dependent/Auth.t (-2 / +8 lines)
Lines 547-553 subtest 'checkauth & check_cookie_auth' => sub { Link Here
547
547
548
    # Logging out!
548
    # Logging out!
549
    $cgi->param('logout.x', 1);
549
    $cgi->param('logout.x', 1);
550
    ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth($cgi, 0, {catalogue => 1});
550
    $cgi->delete( 'userid', 'password' );
551
    {
552
        local *STDOUT;
553
        my $stdout;
554
        open STDOUT, '>', \$stdout;
555
        ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth($cgi, 0, {catalogue => 1});
556
        close STDOUT;
557
    }
551
    is( $sessionID, undef );
558
    is( $sessionID, undef );
552
    is( $ENV{"HTTP_COOKIE"}, "CGISESSID=$first_sessionID", 'HTTP_COOKIE not unset' );
559
    is( $ENV{"HTTP_COOKIE"}, "CGISESSID=$first_sessionID", 'HTTP_COOKIE not unset' );
553
    ( $auth_status, $session) = C4::Auth::check_cookie_auth( $first_sessionID, {catalogue => 1} );
560
    ( $auth_status, $session) = C4::Auth::check_cookie_auth( $first_sessionID, {catalogue => 1} );
554
- 

Return to bug 29915