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