Bugzilla – Attachment 164981 Details for
Bug 36617
The old googleopenidconnect service should redirect to page that initiated login
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Allow old googleopenidconnect service to redirect to referring page if possible and appropriate.
0001-Allow-old-googleopenidconnect-service-to-redirect-to.patch (text/plain), 2.01 KB, created by
Nicholas van Oudtshoorn
on 2024-04-17 08:42:56 UTC
(
hide
)
Description:
Allow old googleopenidconnect service to redirect to referring page if possible and appropriate.
Filename:
MIME Type:
Creator:
Nicholas van Oudtshoorn
Created:
2024-04-17 08:42:56 UTC
Size:
2.01 KB
patch
obsolete
>From 3dbebb471357f18bbf460160711c881bf9587f33 Mon Sep 17 00:00:00 2001 >From: Nicholas van Oudtshoorn <vanoudt@gmail.com> >Date: Wed, 17 Apr 2024 16:39:07 +0800 >Subject: [PATCH] Allow old googleopenidconnect service to redirect to > referring page if possible and appropriate. > >--- > opac/svc/auth/googleopenidconnect | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > >diff --git a/opac/svc/auth/googleopenidconnect b/opac/svc/auth/googleopenidconnect >index 5a18c87a38..6228bef7fc 100755 >--- a/opac/svc/auth/googleopenidconnect >+++ b/opac/svc/auth/googleopenidconnect >@@ -214,10 +214,15 @@ elsif ( defined $query->param('code') ) { > > #handle redirect to main.pl, for private opac > my $uri; >- if (C4::Context->preference('OpacPublic') ) { >- $uri = '/cgi-bin/koha/opac-user.pl'; >- } else { >- $uri = '/cgi-bin/koha/opac-main.pl'; >+ my $referer = $session->param( 'auth-refer-uri' ); >+ if ($referer) { >+ $uri = $referer =~ s/$regex//rg; >+ } else { >+ if (C4::Context->preference('OpacPublic') ) { >+ $uri = '/cgi-bin/koha/opac-user.pl'; >+ } else { >+ $uri = '/cgi-bin/koha/opac-main.pl'; >+ } > } > print $query->redirect( > -uri => $uri, >@@ -244,6 +249,12 @@ else { > my $openidstate = 'auth_'; > $openidstate .= sprintf( "%x", rand 16 ) for 1 .. 32; > $session->param( 'google-openid-state', $openidstate ); >+ my $referrer_uri = $ENV{HTTP_REFERER}; >+ my $logoutregex = qr/logout\.x=1/mp; >+ if ($referrer_uri && ($referrer_uri =~ /^\Q$host\E/ )) { >+ $referrer_uri =~ s/$logoutregex//rg; >+ $session->param('auth-refer-uri', $referrer_uri ); >+ } > $session->flush(); > > my $prompt = $query->param('reauthenticate') // q{}; >-- >2.34.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 36617
: 164981