Browse Source

Bug 17153: Redirect to search when logging in from search

This patch is a fresh attempt at redirecting back to search
results after logging in on opac-search.pl

To test:
- Perform an OPAC search
- Login on opac-search.pl with the search results displayed
- The page is redirected to opac-user.pl
- Log out
- Apply the patch
- Perform a new OPAC search
- Note the URL query string
- Login on opac-search.pl with the search results displayed
- The opac-search.pl page should be displayed with the correct
  query string and the page should indicate a logged in status

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and the patch works.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Lee Jamison 6 years ago
committed by Nick Clemens
parent
commit
fa25c45ffc
  1. 1
      koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
  2. 1
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
  3. 10
      koha-tmpl/opac-tmpl/bootstrap/js/authtoresults.js
  4. 12
      opac/opac-user.pl

1
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc

@ -301,6 +301,7 @@
<h3 id="modalLoginLabel">Log in to your account</h3>
</div>
<form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="modalAuth">
<input type="hidden" name="has-search-query" id="has-search-query" value="" />
<div class="modal-body">
[% IF ( shibbolethAuthentication ) %]
[% IF ( invalidShibLogin ) %]

1
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt

@ -594,6 +594,7 @@
[% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %][% Asset.js("lib/jquery/plugins/jquery.rating.js") %][% END %]
[% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") %][% END %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
[% Asset.js("js/authtoresults.js") %]
[% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") %]
[% END %]<script>
//<![CDATA[

10
koha-tmpl/opac-tmpl/bootstrap/js/authtoresults.js

@ -0,0 +1,10 @@
if (window.location.href.indexOf("opac-search.pl") > -1) {
// extract search params
var searchUrl = location.href;
var searchParams = searchUrl.substring(searchUrl.indexOf("?")+1);
// store search params in loginModal to pass back on redirect
var query = document.getElementById("has-search-query");
query.value = searchParams;
}

12
opac/opac-user.pl

@ -362,4 +362,16 @@ $template->param(
failed_holds => scalar $query->param('failed_holds'),
);
# if not an empty string this indicates to return
# back to the opac-results page
my $search_query = $query->param('has-search-query');
if ($search_query ne '') {
print $query->redirect(
-uri => "/cgi-bin/koha/opac-search.pl?$search_query",
-cookie => $cookie,
);
}
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };

Loading…
Cancel
Save