Bugzilla – Attachment 129823 Details for
Bug 29924
Introduce password expiration to patron categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29924: (follow-up) Generate necessary template variables before output
Bug-29924-follow-up-Generate-necessary-template-va.patch (text/plain), 3.56 KB, created by
Nick Clemens
on 2022-01-26 11:01:38 UTC
(
hide
)
Description:
Bug 29924: (follow-up) Generate necessary template variables before output
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2022-01-26 11:01:38 UTC
Size:
3.56 KB
patch
obsolete
>From e54846317f075c7c02cdaf376077e88100059b88 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 26 Jan 2022 10:58:40 +0000 >Subject: [PATCH] Bug 29924: (follow-up) Generate necessary template variables > before output > >--- > C4/Auth.pm | 37 ++++++++++++++++++++++++------------- > 1 file changed, 24 insertions(+), 13 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 29ef133d47..673c73ae93 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -197,8 +197,8 @@ sub get_template_and_user { > } > } > >+ my $kick_out; > if ( $in->{type} eq 'opac' && $user ) { >- my $kick_out; > > if ( > # If the user logged in is the SCO user and they try to go out of the SCO module, >@@ -257,12 +257,12 @@ sub get_template_and_user { > } > > my $borrowernumber; >+ my $patron; > if ($user) { > > # It's possible for $user to be the borrowernumber if they don't have a > # userid defined (and are logging in through some other method, such > # as SSL certs against an email address) >- my $patron; > $borrowernumber = getborrowernumber($user) if defined($user); > if ( !defined($borrowernumber) && defined($user) ) { > $patron = Koha::Patrons->find( $user ); >@@ -279,6 +279,7 @@ sub get_template_and_user { > } > > if ($patron->password_expired) { >+ # Here we will force the user to the login page > my $reset_template_name = ( $in->{type} eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt'; > $template = C4::Templates::gettemplate( $reset_template_name, $in->{type}, > $in->{query} ); >@@ -297,18 +298,15 @@ sub get_template_and_user { > script_name => get_script_name(), > ); > >- print $in->{query}->header( >- { >- type => 'text/html', >- charset => 'utf-8', >- cookie => $cookie, >- 'X-Frame-Options' => 'SAMEORIGIN' >- } >- ), >- $template->output; >- safe_exit; >+ # We still want to generate the global variables for the templates, so we will >+ # output the login page at the end of this routine >+ $user = undef; >+ $kick_out = 1; >+ > } >+ } > >+ if( $user ) { > # user info > $template->param( loggedinusername => $user ); # OBSOLETE - Do not reuse this in template, use logged_in_user.userid instead > $template->param( loggedinusernumber => $borrowernumber ); # FIXME Should be replaced with logged_in_user.borrowernumber >@@ -658,7 +656,6 @@ sub get_template_and_user { > PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), > useDischarge => C4::Context->preference('useDischarge'), > ); >- > $template->param( OpacPublic => '1' ) if ( $user || C4::Context->preference("OpacPublic") ); > } > >@@ -676,6 +673,20 @@ sub get_template_and_user { > } > } > >+ if( $kick_out ){ >+ # Output to auth page if user has been forcibly logged out >+ # due to password expiration >+ print $in->{query}->header( >+ { >+ type => 'text/html', >+ charset => 'utf-8', >+ cookie => $cookie, >+ 'X-Frame-Options' => 'SAMEORIGIN' >+ } >+ ), >+ $template->output; >+ safe_exit; >+ } > return ( $template, $borrowernumber, $cookie, $flags ); > } > >-- >2.30.2
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 29924
:
129705
|
129706
|
129707
|
129708
|
129762
|
129763
|
129764
|
129765
|
129766
|
129823
|
129953
|
129954
|
129955
|
129956
|
129957
|
130116
|
130117
|
130118
|
130119
|
130120
|
130495
|
130500
|
130501
|
130502
|
130503
|
130504
|
130505
|
130557
|
130558
|
130559
|
130560
|
130561
|
130562
|
130563
|
130677
|
130678
|
130679
|
130680
|
130681
|
130682
|
130683
|
131128
|
132059
|
132060
|
132061
|
132062
|
132063
|
132064
|
132065
|
132066
|
132084
|
132085
|
132086
|
132087
|
132088
|
132089
|
132090
|
132091
|
132092
|
133741
|
133742
|
133743
|
133744
|
133745
|
133746
|
133747
|
133748
|
133801
|
133802
|
133803
|
133804
|
133805
|
133806
|
133807
|
133808
|
133809
|
133810
|
133989
|
134758