Bugzilla – Attachment 51300 Details for
Bug 15816
Timeout login redirects to home page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15816: Redirect back to correct page after login
Bug-15816-Redirect-back-to-correct-page-after-logi.patch (text/plain), 4.39 KB, created by
Jesse Weaver
on 2016-05-06 20:00:08 UTC
(
hide
)
Description:
Bug 15816: Redirect back to correct page after login
Filename:
MIME Type:
Creator:
Jesse Weaver
Created:
2016-05-06 20:00:08 UTC
Size:
4.39 KB
patch
obsolete
>From 98e5959f38793987f39dc9fc9b2cd9b8c025726c Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <jweaver@bywatersolutions.com> >Date: Fri, 6 May 2016 13:52:46 -0600 >Subject: [PATCH] Bug 15816: Redirect back to correct page after login > >This uses a hacky but simple method to get the correct script name under >proxied packaged Plack. > >Test plan: > 1) Log out of both the OPAC and staff side. > 2) Try to access a page that requires login (opac-reserve.pl is a >good one for the OPAC), then log in. > 3) You will be redirected back to mainpage.pl or opac-user.pl. > 4) Repeat above for both staff side and OPAC. > 5) Apply patch. > 6) Repeat steps 1-4; you should be redirected back to the original > page you were on. > 7) Repeat the above for both a traditional CGI and kohadevbox/package > Plack installation. >--- > C4/Auth.pm | 24 +++++++++++++++++++++- > koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-auth.tt | 2 +- > 3 files changed, 25 insertions(+), 3 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 3081f07..c06fc1a 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -192,7 +192,10 @@ sub get_template_and_user { > -HttpOnly => 1, > ); > >- $template->param( loginprompt => 1 ); >+ $template->param( >+ loginprompt => 1, >+ script_name => _get_script_name(), >+ ); > print $in->{query}->header( > { type => 'text/html', > charset => 'utf-8', >@@ -1208,6 +1211,7 @@ sub checkauth { > opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"), > login => 1, > INPUTS => \@inputs, >+ script_name => _get_script_name(), > casAuthentication => C4::Context->preference("casAuthentication"), > shibbolethAuthentication => $shib, > SessionRestrictionByIP => C4::Context->preference("SessionRestrictionByIP"), >@@ -2041,6 +2045,24 @@ sub getborrowernumber { > return 0; > } > >+=head2 _get_script_name >+ >+This returns the correct script name, for use in redirecting back to the correct page after showing >+the login screen. It depends on details of the package Plack configuration, and should not be used >+outside this context. >+ >+=cut >+ >+sub _get_script_name { >+ # This is the method about.pl uses to detect Plack; now that two places use it, it MUST be >+ # right. >+ if ( ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) && $ENV{SCRIPT_NAME} =~ m,^/(intranet|opac)(.*), ) { >+ return '/cgi-bin/koha' . $2; >+ } else { >+ return $ENV{SCRIPT_NAME}; >+ } >+} >+ > END { } # module clean-up code here (global destructor) > 1; > __END__ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >index 2896886..8887812 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >@@ -40,7 +40,7 @@ > [% END %] > > <!-- login prompt time--> >-<form action="/cgi-bin/koha/mainpage.pl" method="post" name="loginform" id="loginform"> >+<form action="[% script_name %]" method="post" name="loginform" id="loginform"> > <input type="hidden" name="koha_login_context" value="intranet" /> > [% FOREACH INPUT IN INPUTS %] > <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]" /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >index 64ea0f8..3b1aac3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt >@@ -155,7 +155,7 @@ > [% IF SCO_login %] > <form action="/cgi-bin/koha/sco/sco-main.pl" name="auth" id="auth" method="post"> > [% ELSE %] >- <form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post"> >+ <form action="[% script_name %]" name="auth" id="auth" method="post"> > [% END %] > <input type="hidden" name="koha_login_context" value="opac" /> > <fieldset class="brief"> >-- >2.8.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15816
:
51300
|
51323
|
51324