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

(-)a/C4/Auth.pm (+1 lines)
Lines 1201-1206 sub checkauth { Link Here
1201
                        $domain =~ s|\.\*||g;
1201
                        $domain =~ s|\.\*||g;
1202
                        if ( $ip !~ /^$domain/ ) {
1202
                        if ( $ip !~ /^$domain/ ) {
1203
                            $loggedin = 0;
1203
                            $loggedin = 0;
1204
                            $auth_state = 'failed';
1204
                            $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie(
1205
                            $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie(
1205
                                -name     => 'CGISESSID',
1206
                                -name     => 'CGISESSID',
1206
                                -value    => '',
1207
                                -value    => '',
(-)a/t/db_dependent/Auth.t (-2 / +9 lines)
Lines 374-380 subtest 'checkauth() tests' => sub { Link Here
374
374
375
    subtest 'loggedinlibrary permission tests' => sub {
375
    subtest 'loggedinlibrary permission tests' => sub {
376
376
377
        plan tests => 3;
377
        plan tests => 5;
378
        my $staff_user = $builder->build_object(
378
        my $staff_user = $builder->build_object(
379
            { class => 'Koha::Patrons', value => { flags => 536870916 } } );
379
            { class => 'Koha::Patrons', value => { flags => 536870916 } } );
380
380
Lines 411-416 subtest 'checkauth() tests' => sub { Link Here
411
        $sesh = C4::Auth::get_session($sessionID);
411
        $sesh = C4::Auth::get_session($sessionID);
412
        is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" );
412
        is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" );
413
413
414
        t::lib::Mocks::mock_preference( 'AutoLocation', 1 );
415
        ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired' );
416
        is( $userid, undef, "Library user at ip not in branch should not be logged in under AutoLocation" );
417
418
        $staff_user->branchcode($branch->branchcode)->store->discard_changes;
419
        $branch->branchip($ENV{REMOTE_ADDR})->store->discard_changes;
420
        ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired' );
421
        is( $userid, $staff_user->userid, "Library user at ip in branch should be logged in under AutoLocation" );
414
    };
422
    };
415
    C4::Context->_new_userenv; # For next tests
423
    C4::Context->_new_userenv; # For next tests
416
};
424
};
417
- 

Return to bug 36028