Bug 31699: (follow-up) Protect against unauthorized redirects

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-11-09 08:27:44 +00:00 committed by Tomas Cohen Arazi
parent 507d48413d
commit e0760fd185
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 4 additions and 2 deletions

View file

@ -228,7 +228,7 @@ $(document).ready(function(){
var button = $(this);
var context = button.data('return');
if ( context ) {
$('#modalAuth').append('<input type="hidden" name="return" value="'+window.location+'" />');
$('#modalAuth').append('<input type="hidden" name="return" value="'+window.location.pathname+window.location.search+'" />');
}
$("#loginModal").modal("show");
});

View file

@ -428,8 +428,10 @@ if ($search_query) {
# back to the page we triggered the login from
my $return = $query->param('return');
if ( $return ) {
my $uri = C4::Context->preference('OPACBaseURL');
$uri .= $return;
print $query->redirect(
-uri => $return,
-uri => $uri,
-cookie => $cookie,
);
}