Lines 28-37
use Koha::DateUtils;
Link Here
|
28 |
use DateTime::TimeZone; |
28 |
use DateTime::TimeZone; |
29 |
|
29 |
|
30 |
my $cgi = CGI->new; |
30 |
my $cgi = CGI->new; |
|
|
31 |
my $nocookie = $cgi->param('nocookie') || 0; |
31 |
|
32 |
|
32 |
# get the status of the user, this will check his credentials and rights |
33 |
# get the status of the user, this will check his credentials and rights |
33 |
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); |
34 |
my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); |
34 |
($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok'); |
35 |
($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok' && !$nocookie); |
35 |
|
36 |
|
36 |
my $result; |
37 |
my $result; |
37 |
|
38 |
|
Lines 77-85
if ($status eq 'ok') { # if authentication is ok
Link Here
|
77 |
} |
78 |
} |
78 |
); |
79 |
); |
79 |
} |
80 |
} |
80 |
} else { |
81 |
|
81 |
$result = "Authentication failed." |
82 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); |
|
|
83 |
print $result; |
84 |
exit; |
82 |
} |
85 |
} |
83 |
|
86 |
|
84 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); |
87 |
print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8', '-status' => '401 Unauthorized'); |
85 |
print $result; |
88 |
print $result; |
86 |
- |
|
|