|
Lines 28-36
use DateTime::TimeZone;
Link Here
|
| 28 |
|
28 |
|
| 29 |
my $cgi = CGI->new; |
29 |
my $cgi = CGI->new; |
| 30 |
|
30 |
|
|
|
31 |
# used by the KOCT firefox extension |
| 32 |
# (or any third-party that doesn't want to rely on cookies for authentication) |
| 33 |
my $nocookie = $cgi->param('nocookie') || 0; |
| 34 |
|
| 31 |
# get the status of the user, this will check his credentials and rights |
35 |
# get the status of the user, this will check his credentials and rights |
| 32 |
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); |
36 |
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); |
| 33 |
($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok'); |
37 |
($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok' && !$nocookie); |
| 34 |
|
38 |
|
| 35 |
my $result; |
39 |
my $result; |
| 36 |
|
40 |
|
|
Lines 76-84
if ($status eq 'ok') { # if authentication is ok
Link Here
|
| 76 |
} |
80 |
} |
| 77 |
); |
81 |
); |
| 78 |
} |
82 |
} |
| 79 |
} else { |
83 |
|
| 80 |
$result = "Authentication failed." |
84 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); |
|
|
85 |
print $result; |
| 86 |
exit; |
| 81 |
} |
87 |
} |
| 82 |
|
88 |
|
| 83 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); |
89 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8', '-status' => '401 Unauthorized'); |
| 84 |
print $result; |
90 |
print $result; |
| 85 |
- |
|
|