Set Content-Type for JSON 401 response

This commit is contained in:
Xavier 2019-06-15 22:26:37 +02:00
parent c1a8723b90
commit fe55ba3567
1 changed files with 7 additions and 2 deletions

View File

@ -226,10 +226,15 @@ sub do {
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
$self->logger->debug('Processing to JSON response');
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
my $s = qq'{"result":0,"error":$err}';
return [
401,
[ 'WWW-Authenticate' => "SSO " . $self->conf->{portal} ],
[qq'{"result":0,"error":$err}']
[
'WWW-Authenticate' => "SSO " . $self->conf->{portal},
'Content-Type' => 'application/json',
'Content-Length' => length($s)
],
[$s]
];
}
elsif ( $err > 0 and $err != PE_PASSWORD_OK ) {