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

(-)a/C4/Auth.pm (-4 / +13 lines)
Lines 690-705 sub checkauth { Link Here
690
            #first we need to clear the anonymous session...
690
            #first we need to clear the anonymous session...
691
            $debug and warn "query id = $q_userid but session id = $s_userid";
691
            $debug and warn "query id = $q_userid but session id = $s_userid";
692
            $anon_search_history = $session->param('search_history');
692
            $anon_search_history = $session->param('search_history');
693
            $session->flush;
694
            $session->delete();
693
            $session->delete();
694
            $session->flush;
695
            C4::Context->_unset_userenv($sessionID);
695
            C4::Context->_unset_userenv($sessionID);
696
            $sessionID = undef;
696
            $sessionID = undef;
697
            $userid = undef;
697
            $userid = undef;
698
        }
698
        }
699
        elsif ($logout) {
699
        elsif ($logout) {
700
            # voluntary logout the user
700
            # voluntary logout the user
701
            $session->flush;
702
            $session->delete();
701
            $session->delete();
702
            $session->flush;
703
            C4::Context->_unset_userenv($sessionID);
703
            C4::Context->_unset_userenv($sessionID);
704
            #_session_log(sprintf "%20s from %16s logged out at %30s (manually).\n", $userid,$ip,(strftime "%c",localtime));
704
            #_session_log(sprintf "%20s from %16s logged out at %30s (manually).\n", $userid,$ip,(strftime "%c",localtime));
705
            $sessionID = undef;
705
            $sessionID = undef;
Lines 712-718 sub checkauth { Link Here
712
        elsif ( !$lasttime || ($lasttime < time() - $timeout) ) {
712
        elsif ( !$lasttime || ($lasttime < time() - $timeout) ) {
713
            # timed logout
713
            # timed logout
714
            $info{'timed_out'} = 1;
714
            $info{'timed_out'} = 1;
715
            $session->delete() if $session;
715
            if ($session) {
716
                $session->delete();
717
                $session->flush;
718
            }
716
            C4::Context->_unset_userenv($sessionID);
719
            C4::Context->_unset_userenv($sessionID);
717
            #_session_log(sprintf "%20s from %16s logged out at %30s (inactivity).\n", $userid,$ip,(strftime "%c",localtime));
720
            #_session_log(sprintf "%20s from %16s logged out at %30s (inactivity).\n", $userid,$ip,(strftime "%c",localtime));
718
            $userid    = undef;
721
            $userid    = undef;
Lines 724-729 sub checkauth { Link Here
724
            $info{'newip'}        = $ENV{'REMOTE_ADDR'};
727
            $info{'newip'}        = $ENV{'REMOTE_ADDR'};
725
            $info{'different_ip'} = 1;
728
            $info{'different_ip'} = 1;
726
            $session->delete();
729
            $session->delete();
730
            $session->flush;
727
            C4::Context->_unset_userenv($sessionID);
731
            C4::Context->_unset_userenv($sessionID);
728
            #_session_log(sprintf "%20s from %16s logged out at %30s (ip changed to %16s).\n", $userid,$ip,(strftime "%c",localtime), $info{'newip'});
732
            #_session_log(sprintf "%20s from %16s logged out at %30s (ip changed to %16s).\n", $userid,$ip,(strftime "%c",localtime), $info{'newip'});
729
            $sessionID = undef;
733
            $sessionID = undef;
Lines 1201-1206 sub check_api_auth { Link Here
1201
            if ( $lasttime < time() - $timeout ) {
1205
            if ( $lasttime < time() - $timeout ) {
1202
                # time out
1206
                # time out
1203
                $session->delete();
1207
                $session->delete();
1208
                $session->flush;
1204
                C4::Context->_unset_userenv($sessionID);
1209
                C4::Context->_unset_userenv($sessionID);
1205
                $userid    = undef;
1210
                $userid    = undef;
1206
                $sessionID = undef;
1211
                $sessionID = undef;
Lines 1208-1213 sub check_api_auth { Link Here
1208
            } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
1213
            } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
1209
                # IP address changed
1214
                # IP address changed
1210
                $session->delete();
1215
                $session->delete();
1216
                $session->flush;
1211
                C4::Context->_unset_userenv($sessionID);
1217
                C4::Context->_unset_userenv($sessionID);
1212
                $userid    = undef;
1218
                $userid    = undef;
1213
                $sessionID = undef;
1219
                $sessionID = undef;
Lines 1224-1229 sub check_api_auth { Link Here
1224
                    return ("ok", $cookie, $sessionID);
1230
                    return ("ok", $cookie, $sessionID);
1225
                } else {
1231
                } else {
1226
                    $session->delete();
1232
                    $session->delete();
1233
                    $session->flush;
1227
                    C4::Context->_unset_userenv($sessionID);
1234
                    C4::Context->_unset_userenv($sessionID);
1228
                    $userid    = undef;
1235
                    $userid    = undef;
1229
                    $sessionID = undef;
1236
                    $sessionID = undef;
Lines 1440-1445 sub check_cookie_auth { Link Here
1440
        if ( $lasttime < time() - $timeout ) {
1447
        if ( $lasttime < time() - $timeout ) {
1441
            # time out
1448
            # time out
1442
            $session->delete();
1449
            $session->delete();
1450
            $session->flush;
1443
            C4::Context->_unset_userenv($sessionID);
1451
            C4::Context->_unset_userenv($sessionID);
1444
            $userid    = undef;
1452
            $userid    = undef;
1445
            $sessionID = undef;
1453
            $sessionID = undef;
Lines 1447-1452 sub check_cookie_auth { Link Here
1447
        } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
1455
        } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
1448
            # IP address changed
1456
            # IP address changed
1449
            $session->delete();
1457
            $session->delete();
1458
            $session->flush;
1450
            C4::Context->_unset_userenv($sessionID);
1459
            C4::Context->_unset_userenv($sessionID);
1451
            $userid    = undef;
1460
            $userid    = undef;
1452
            $sessionID = undef;
1461
            $sessionID = undef;
Lines 1458-1463 sub check_cookie_auth { Link Here
1458
                return ("ok", $sessionID);
1467
                return ("ok", $sessionID);
1459
            } else {
1468
            } else {
1460
                $session->delete();
1469
                $session->delete();
1470
                $session->flush;
1461
                C4::Context->_unset_userenv($sessionID);
1471
                C4::Context->_unset_userenv($sessionID);
1462
                $userid    = undef;
1472
                $userid    = undef;
1463
                $sessionID = undef;
1473
                $sessionID = undef;
1464
- 

Return to bug 10952