Set Content-Type for JSON 401 response
This commit is contained in:
parent
c1a8723b90
commit
fe55ba3567
|
@ -226,10 +226,15 @@ sub do {
|
||||||
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
|
if ( !$self->conf->{noAjaxHook} and $req->wantJSON ) {
|
||||||
$self->logger->debug('Processing to JSON response');
|
$self->logger->debug('Processing to JSON response');
|
||||||
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
|
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
|
||||||
|
my $s = qq'{"result":0,"error":$err}';
|
||||||
return [
|
return [
|
||||||
401,
|
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 ) {
|
elsif ( $err > 0 and $err != PE_PASSWORD_OK ) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user