Bug 31699: Add 'return' option to opac modal login
This patch adds the option to trigger a redirect back to the current
context after successful login using modal logins triggered from various
places in the OPAC.
To make use of this, simply add 'data-return="true"' to the modal trigger link.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 507d48413d
)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
parent
24363f91da
commit
7a5ad16654
2 changed files with 15 additions and 0 deletions
|
@ -225,6 +225,11 @@ $(document).ready(function(){
|
|||
|
||||
$(".loginModal-trigger").on("click",function(e){
|
||||
e.preventDefault();
|
||||
var button = $(this);
|
||||
var context = button.data('return');
|
||||
if ( context ) {
|
||||
$('#modalAuth').append('<input type="hidden" name="return" value="'+window.location+'" />');
|
||||
}
|
||||
$("#loginModal").modal("show");
|
||||
});
|
||||
$("#loginModal").on("shown.bs.modal", function(){
|
||||
|
|
|
@ -424,4 +424,14 @@ if ($search_query) {
|
|||
);
|
||||
}
|
||||
|
||||
# if not an empty string this indicates to return
|
||||
# back to the page we triggered the login from
|
||||
my $return = $query->param('return');
|
||||
if ( $return ) {
|
||||
print $query->redirect(
|
||||
-uri => $return,
|
||||
-cookie => $cookie,
|
||||
);
|
||||
}
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
|
||||
|
|
Loading…
Reference in a new issue