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

(-)a/C4/Auth.pm (-1 / +3 lines)
Lines 1614-1620 Possible return values in C<$status> are: Link Here
1614
sub check_cookie_auth {
1614
sub check_cookie_auth {
1615
    my $cookie        = shift;
1615
    my $cookie        = shift;
1616
    my $flagsrequired = shift;
1616
    my $flagsrequired = shift;
1617
    my $params        = shift;
1617
1618
1619
    my $remote_addr = $params->{remote_addr} || $ENV{REMOTE_ADDR};
1618
    my $dbh     = C4::Context->dbh;
1620
    my $dbh     = C4::Context->dbh;
1619
    my $timeout = _timeout_syspref();
1621
    my $timeout = _timeout_syspref();
1620
1622
Lines 1671-1677 sub check_cookie_auth { Link Here
1671
            $userid    = undef;
1673
            $userid    = undef;
1672
            $sessionID = undef;
1674
            $sessionID = undef;
1673
            return ("expired", undef);
1675
            return ("expired", undef);
1674
        } elsif ( C4::Context->preference('SessionRestrictionByIP') && $ip ne $ENV{'REMOTE_ADDR'} ) {
1676
        } elsif ( C4::Context->preference('SessionRestrictionByIP') && $ip ne $remote_addr ) {
1675
1677
1676
            # IP address changed
1678
            # IP address changed
1677
            $session->delete();
1679
            $session->delete();
(-)a/Koha/REST/V1.pm (-2 / +3 lines)
Lines 29-35 sub startup { Link Here
29
        cb => sub {
29
        cb => sub {
30
            my $c = shift;
30
            my $c = shift;
31
31
32
            my ($status, $sessionID) = check_cookie_auth($c->cookie('CGISESSID'));
32
            # ENV{REMOTE_ADDR} is not set here, we need to read the headers
33
            my $remote_addr = $c->req->headers->header('x-forwarded-for');
34
            my ($status, $sessionID) = check_cookie_auth($c->cookie('CGISESSID'), undef, { remote_addr => $remote_addr });
33
            if ($status eq "ok") {
35
            if ($status eq "ok") {
34
                my $session = get_session($sessionID);
36
                my $session = get_session($sessionID);
35
                my $user = Koha::Patrons->find($session->param('number'));
37
                my $user = Koha::Patrons->find($session->param('number'));
36
- 

Return to bug 17050