Fix Ajax responses when rejected
This commit is contained in:
parent
01424a71ac
commit
c09797ff11
|
@ -143,6 +143,18 @@ sub _authAndTrace {
|
|||
}
|
||||
}
|
||||
elsif ( $res < 400 ) {
|
||||
if ( $req->wantJSON ) {
|
||||
my %h = ( $req->spliceHdrs );
|
||||
my $host = $req->env->{HTTP_HOST};
|
||||
if ( $h{Location}
|
||||
and $h{Location} =~ m#^\Q$self->{portal}\E#
|
||||
and $h{Location} !~ m#^https?://$host# )
|
||||
{
|
||||
return [
|
||||
401, [ 'WWW-Authenticate' => 'SSO ' . $self->{portal} ], []
|
||||
];
|
||||
}
|
||||
}
|
||||
return [ $res, [ $req->spliceHdrs ], [] ];
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue